Load nix conditionally, allowing extra function definition

This commit is contained in:
Loic Nageleisen 2023-10-25 10:54:50 +02:00
parent 13fb27218f
commit c312511fb3
Signed by: lloeki
GPG key ID: D05DAEE6889F94C2

8
shell/nix Normal file → Executable file
View file

@ -1,7 +1,11 @@
if [[ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then if [[ -z "NIX_PATH" && -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
elif [[ -e "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]]; then elif [[ -z "NIX_PATH" && -e "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]]; then
. "${HOME}/.nix-profile/etc/profile.d/nix.sh" . "${HOME}/.nix-profile/etc/profile.d/nix.sh"
fi fi
function nix-channel-version() {
nix-instantiate --eval -A 'lib.version' '<nixpkgs>'
}
# vim: ft=bash # vim: ft=bash