From 1b97d7409a2eebc08d8f87cc57d19c7a6c081ef1 Mon Sep 17 00:00:00 2001 From: Stefan Boca Date: Tue, 20 May 2025 22:01:56 -0700 Subject: [PATCH] nix-profile{,-daemon}.fish: fix do not source twice Commit b36637c8f7ab7a2b93c6eae1139ea1c672700186 set `__ETC_PROFILE_NIX_SOURCED` globally, but this is not enough to prevent the script from being run again by child shells, because the variable was not exported and thus not inherited by any child process. Exporting the variable also agrees with the bash scripts. Notably, the old behavior broke `nix develop -c fish` in some cases, because the profile bin directory got prepended to the path, causing binaries from the profile to override binareis from the devshell. (cherry picked from commit b9ed3ae36e362120a480fb3a916d0cbc437b377a) --- scripts/nix-profile-daemon.fish.in | 2 +- scripts/nix-profile.fish.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/nix-profile-daemon.fish.in b/scripts/nix-profile-daemon.fish.in index f7cc5239e..fffa06293 100644 --- a/scripts/nix-profile-daemon.fish.in +++ b/scripts/nix-profile-daemon.fish.in @@ -3,7 +3,7 @@ if test -z "$HOME" || test -n "$__ETC_PROFILE_NIX_SOURCED" exit end -set --global __ETC_PROFILE_NIX_SOURCED 1 +set --global --export __ETC_PROFILE_NIX_SOURCED 1 # Local helpers diff --git a/scripts/nix-profile.fish.in b/scripts/nix-profile.fish.in index f7cc5239e..fffa06293 100644 --- a/scripts/nix-profile.fish.in +++ b/scripts/nix-profile.fish.in @@ -3,7 +3,7 @@ if test -z "$HOME" || test -n "$__ETC_PROFILE_NIX_SOURCED" exit end -set --global __ETC_PROFILE_NIX_SOURCED 1 +set --global --export __ETC_PROFILE_NIX_SOURCED 1 # Local helpers