nix-profile{,-daemon}.fish: fix do not source twice (backport #13244)#13590
Merged
mergify[bot] merged 2 commits into2.29-maintenancefrom Jul 30, 2025
Merged
Conversation
(cherry picked from commit f627b8c)
Commit b36637c 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 b9ed3ae)
37 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
I was running into an issue with
nix develop -c fishwhere binaries in my profile were overriding binaries from my dev shell. This because thenix-profile.fishscripts were sourced again in the child shell, which prepended the nix profile toPATH.This PR exports
__ETC_PROFILE_NIX_SOURCEDfrom the fish profile scripts to prevent the scripts from running in child shells. This matches the bash profile scripts behavior.Context
Commit b36637c set
__ETC_PROFILE_NIX_SOURCEDglobally, 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.Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.
This is an automatic backport of pull request #13244 done by [Mergify](https://mergify.com).