From c312511fb3a86566e466ccc81bdb1e946bc43c35 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Wed, 25 Oct 2023 10:54:50 +0200 Subject: [PATCH] Load nix conditionally, allowing extra function definition --- shell/nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 shell/nix diff --git a/shell/nix b/shell/nix old mode 100644 new mode 100755 index 1822cfe..e5e78e1 --- a/shell/nix +++ b/shell/nix @@ -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' -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" fi +function nix-channel-version() { + nix-instantiate --eval -A 'lib.version' '' +} + # vim: ft=bash