Repository navigation
programs/bash: refresh session variables in interactive shells - #9865
Open
khaneliman wants to merge 1 commit into
Open
khaneliman wants to merge 1 commit into
khaneliman wants to merge 1 commit into
Conversation
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
August 28, 2026 06:17
b128abd to
bd75139
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
August 28, 2026 19:53
bd75139 to
4428531
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
2 times, most recently
from
August 28, 2026 20:58
aa02619 to
67aeef0
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
August 28, 2026 21:04
67aeef0 to
16cd53f
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
2 times, most recently
from
August 29, 2026 04:20
a791e07 to
b6a82f6
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
August 29, 2026 04:47
b6a82f6 to
b1d67a5
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
2 times, most recently
from
August 29, 2026 14:26
41fb156 to
8ef4557
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
2 times, most recently
from
August 30, 2026 03:48
06e09a5 to
dcf95bb
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
2 times, most recently
from
August 30, 2026 22:54
56f2c74 to
e16d832
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
August 30, 2026 23:49
e16d832 to
cc91b3b
Compare
khaneliman
marked this pull request as ready for review
August 30, 2026 23:51
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
September 9, 2026 22:13
cc91b3b to
23a62b0
Compare
4 of 5 tasks
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
September 11, 2026 03:12
23a62b0 to
85ef91e
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
September 30, 2026 04:23
85ef91e to
1e2413d
Compare
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
2 times, most recently
from
October 1, 2026 02:11
2fc1a77 to
6ed09be
Compare
Interactive non-login Bash shells now apply the current session variables file before bashrcExtra and initExtra. New terminals pick up values changed by home-manager switch. Login shells skip the refresh because .profile already applied it. Non-interactive shells skip it because sshd can read .bashrc for remote commands, where startup output can corrupt protocols such as scp and rsync. Apply programs.bash.sessionVariables after generic values to preserve its precedence. Expansions run on every interactive non-login shell, so warn when direct self-references can change repeatedly. Declarative search paths remain stable across repeated sourcing. A profileExtra assignment that collides with a Home Manager-managed variable is now overwritten in non-login shells. Move such overrides to initExtra, which runs after the refresh. targets.genericLinux no longer needs its separate initExtra source.
khaneliman
force-pushed
the
session-vars-9-bash-refresh
branch
from
November 18, 2026 01:13
6ed09be to
4bca12c
Compare
This branch has not been deployed
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.
Description
Interactive non-login Bash shells now apply the session variables file, so a new terminal picks up values changed by
home-manager switch. Zsh and Fish got this earlier in the stack; Bash needs its own gate:[[ $- == *i* ]] && ! shopt -q login_shell. Login shells are skipped because.profilealready applied the file. Non-interactive shells are skipped because Bash can read.bashrcfor remote commands, where startup output can corrupt protocols such as scp and rsync.The generic Linux hook no longer sources the session variables file separately; it keeps its existing
nix.shcall, which #9925 above replaces.There is no ownership manifest; ordering does its job. The refresh runs first, then
bashrcExtra, theninitExtra, so anything that must survive is declared in a place that runs after it.programs.bash.sessionVariablesis reapplied after the generic values to preserve its precedence. Its expansions run whenever an interactive non-login shell starts. Direct self-references can therefore change repeatedly; Home Manager warns about the forms it can detect. Declarative search variables remain idempotent.Stated compatibility break: a
profileExtraassignment to a name Home Manager also manages previously reached these shells by inheritance and is now overwritten. The release note and news entry say so and point atinitExtraas the migration target.Part of splitting #9735 into independently reviewable changes; the stack as a whole supersedes that PR.
Checklist
profileExtracollisions; release note and news entry included.)nix fmt.nix build .#test-all.{component}: {description}format.