1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

installer: prepend nix paths to shell config files instead of appending

Some distribution will stop evaluating the shell config file if
they are not running in an interactive shell. As we append the nix
paths to the end of the file, they will not be evaluated.

We better prepend the nix paths to the shell config files to be sure
that once nix is installed, nix path will be available in any shell.

Note that this is already the case for the detsys installer script for
a while: https://github.com/DeterminateSystems/nix-installer/pull/148

Possibly related errors:

https://github.com/NixOS/nix/issues/8061
https://github.com/NixOS/nix/pull/6628
https://github.com/NixOS/nix/issues/2587
This commit is contained in:
Jean-François Roche 2025-09-19 13:54:39 +02:00
parent 07b96c1d14
commit a408bc3e30

View file

@ -915,9 +915,11 @@ configure_shell_profile() {
fi
if [ -e "$profile_target" ]; then
shell_source_lines \
| _sudo "extend your $profile_target with nix-daemon settings" \
tee -a "$profile_target"
{
shell_source_lines
cat "$profile_target"
} | _sudo "extend your $profile_target with nix-daemon settings" \
tee "$profile_target"
fi
done