summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Picciano <me@mediocregopher.com>2024-05-17 13:15:48 +0200
committerBrian Picciano <me@mediocregopher.com>2024-05-17 13:15:48 +0200
commit08710dd95d8faf14ef69c48ad2c1ce007f8dd9d8 (patch)
treeaee3d9d460fd46616a0fc2ed5554163fd4f99809
parent4ec951303aa1499cd68569684fac7ec18bd07981 (diff)
Check for nix environment installed via nix profile, if there isn't a system one
-rw-r--r--zsh/default.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/zsh/default.nix b/zsh/default.nix
index b89dea7..a2073e7 100644
--- a/zsh/default.nix
+++ b/zsh/default.nix
@@ -7,8 +7,13 @@
zshrc = pkgs.writeTextDir ".zshrc" ''
# Import before anything else, so that we have the full PATH available for
- # everything following
- . /etc/profile.d/nix-daemon.sh
+ # everything following. We prefer a global install (via the system's actual
+ # package manager) to using nix in the nix profile.
+ if [ -f /etc/profile.d/nix-daemon.sh ]; then
+ . /etc/profile.d/nix-daemon.sh
+ elif [ -f "$HOME"/.nix-profile/etc/profile.d/nix-daemon.sh ]; then
+ . "$HOME"/.nix-profile/etc/profile.d/nix-daemon.sh
+ fi
# oh-my-zsh
export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh