Skip to content

nix-profile{,-daemon}.fish: fix do not source twice (backport #13244)#13590

Merged
mergify[bot] merged 2 commits into2.29-maintenancefrom
mergify/bp/2.29-maintenance/pr-13244
Jul 30, 2025
Merged

nix-profile{,-daemon}.fish: fix do not source twice (backport #13244)#13590
mergify[bot] merged 2 commits into2.29-maintenancefrom
mergify/bp/2.29-maintenance/pr-13244

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jul 30, 2025

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 the nix-profile.fish scripts were sourced again in the child shell, which prepended the nix profile to PATH.

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.


This is an automatic backport of pull request #13244 done by [Mergify](https://mergify.com).

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)
@mergify mergify bot added automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue labels Jul 30, 2025
@mergify mergify bot requested a review from edolstra as a code owner July 30, 2025 12:03
@mergify mergify bot added merge-queue automatic backport This PR is a backport produced by automation (does not trigger backporting) labels Jul 30, 2025
mergify bot added a commit that referenced this pull request Jul 30, 2025
mergify bot added a commit that referenced this pull request Jul 30, 2025
mergify bot added a commit that referenced this pull request Jul 30, 2025
mergify bot added a commit that referenced this pull request Jul 30, 2025
mergify bot added a commit that referenced this pull request Jul 30, 2025
mergify bot added a commit that referenced this pull request Jul 30, 2025
@mergify mergify bot merged commit 8a3d3b2 into 2.29-maintenance Jul 30, 2025
27 checks passed
@mergify mergify bot deleted the mergify/bp/2.29-maintenance/pr-13244 branch July 30, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant