Skip to content

regression: installer has no output in place of nix.sh path #13226

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
2 tasks done
bam80 opened this issue May 17, 2025 · 3 comments
Open
2 tasks done

regression: installer has no output in place of nix.sh path #13226

bam80 opened this issue May 17, 2025 · 3 comments

Comments

@bam80
Copy link
Contributor

bam80 commented May 17, 2025

Describe the bug

In the end of the installation, installer outputs an empty space in place of the etc/profile.d/nix.sh path:

$ bash <(curl -L https://nixos.org/nix/install) 
...
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation
performing a single-user installation of Nix...
copying Nix to /nix/store.............................................................
installing 'nix-2.28.3'
building '/nix/store/j8pmzgxnl2zhq2j1fc3j73qrv2i7k48g-user-environment.drv'...
unpacking 1 channels...

Installation finished!  To ensure that the necessary environment
variables are set, please add the line

  . 

to your shell profile (e.g. ~/.profile).

Additional context

Fedora 41

Checklist


Add 👍 to issues you find important.

@bam80 bam80 added the bug label May 17, 2025
@bam80 bam80 changed the title regression: installer has no output in place of etc/profile.d/nix.sh path regression: installer has no output in place of nix.sh path May 17, 2025
@abathur
Copy link
Member

abathur commented May 18, 2025

It looks like this hasn't been touched in a few years (unless there are some cut lines not visible in the blame):

https://github.com/NixOS/nix/blame/f2671886f5caee2ca7720a7b235aa1e40a2df5c3/scripts/install-nix-from-tarball.sh#L214-L280

From the code, I suspect your homedir has zero of the profiles on lines 219, 231, or 244?

p=
p_sh=$NIX_LINK/etc/profile.d/nix.sh
p_fish=$NIX_LINK/etc/profile.d/nix.fish
if [ -z "$NIX_INSTALLER_NO_MODIFY_PROFILE" ]; then
# Make the shell source nix.sh during login.
for i in .bash_profile .bash_login .profile; do
fn="$HOME/$i"
if [ -w "$fn" ]; then
if ! grep -q "$p_sh" "$fn"; then
echo "modifying $fn..." >&2
printf '\nif [ -e %s ]; then . %s; fi # added by Nix installer\n' "$p_sh" "$p_sh" >> "$fn"
fi
added=1
p=${p_sh}
break
fi
done
for i in .zshenv .zshrc; do
fn="$HOME/$i"
if [ -w "$fn" ]; then
if ! grep -q "$p_sh" "$fn"; then
echo "modifying $fn..." >&2
printf '\nif [ -e %s ]; then . %s; fi # added by Nix installer\n' "$p_sh" "$p_sh" >> "$fn"
fi
added=1
p=${p_sh}
break
fi
done
if [ -d "$HOME/.config/fish" ]; then
fishdir=$HOME/.config/fish/conf.d
if [ ! -d "$fishdir" ]; then
mkdir -p "$fishdir"
fi
fn="$fishdir/nix.fish"
echo "placing $fn..." >&2
printf '\nif test -e %s; . %s; end # added by Nix installer\n' "$p_fish" "$p_fish" > "$fn"
added=1
p=${p_fish}
fi
else
p=${p_sh}
fi
if [ -z "$added" ]; then
cat >&2 <<EOF
Installation finished! To ensure that the necessary environment
variables are set, please add the line
. $p
to your shell profile (e.g. ~/.profile).
EOF
else
cat >&2 <<EOF
Installation finished! To ensure that the necessary environment
variables are set, either log in again, or type
. $p
in your shell.
EOF
fi

If that's right, then this was likely introduced in:

What shell are you using? What profile script paths does it use?

@bam80
Copy link
Contributor Author

bam80 commented May 18, 2025

@abathur that's right, there are no profiles here.
I use bash, with full installation it has ~/.bash_profile, but not in my case.

@bam80
Copy link
Contributor Author

bam80 commented May 18, 2025

If that's right, then this was likely introduced in:

#7014

Just a note I use single-user install mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants