nix-profile{,-daemon}.fish: fix do not source twice #13244
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 fish
where binaries in my profile were overriding binaries from my dev shell. This because thenix-profile.fish
scripts were sourced again in the child shell, which prepended the nix profile toPATH
.This PR exports
__ETC_PROFILE_NIX_SOURCED
from 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_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.Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.