Skip to content

nix not on PATH in tmux on standard Debian 12.11 multi-user install #13255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dnadlinger opened this issue May 23, 2025 · 0 comments
Open

nix not on PATH in tmux on standard Debian 12.11 multi-user install #13255

dnadlinger opened this issue May 23, 2025 · 0 comments
Labels

Comments

@dnadlinger
Copy link

Describe the bug

On a standard Debian 12.11 image, nix is not available inside tmux shells. This is because the Nix profile bin directories are not on the PATH, because the PATH gets reset in /etc/profile, but __ETC_PROFILE_NIX_SOURCED is inherited.

Steps To Reproduce

  1. Start from a stock Debian Bookworm (current: 12.11) image.
  2. sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemon with default options.
  3. Reboot for good measure.
  4. Observe that nix --version succeeds on user's login shell, but not after tmux.

Expected behavior

I expect nix to be available, and any other executables in the profile. However, they are not, as /home/$USER/.nix-profile/bin:/nix/var/nix/profiles/default/bin are not prepended to $PATH in the inner shell.

This is because in /etc/profile, PATH is reset as follows:

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$(id -u)" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH

[…]

Yet __ETC_PROFILE_NIX_SOURCED=1 is inherited from the parent shell, so /etc/profile.d/nix.sh -> /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh returns immediately.

Since this is a very basic setup (no customisations made to the stock Debian install), I just expect this to work.

Metadata

nix-env (Nix) 2.29.0

@dnadlinger dnadlinger added the bug label May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant