How to load your .bash_profile into nix shell

For those of us with a heavily customized environment, eg lots of shell aliases, prompt, functions, etc, it’s useful to be able to have all of that within a nix shell. After some digging, I came up with this:

nix-shell --command '. ~/.bash_profile; return' https://holochain.love

This likely works with other shells than bash, but haven’t tried there.

Personally, I alias this, so I just type love, after adding this to my ~/.bash_profile :

alias love="nix-shell --command '. ~/.bash_profile; return' https://holochain.love"
3 Likes