DeterminateSystems / nix-installer

Install Nix and flakes with the fast and reliable Determinate Nix Installer, with over 2 million installs.
GNU Lesser General Public License v2.1
1.79k stars 47 forks source link

Installer emits a warning when installing on Bluefin, and doesn't configure shell hooks #889

Open pauldoo opened 3 months ago

pauldoo commented 3 months ago

Using the nix-installer version 0.17.1 on Bluefin (a Linux distribution derived from Fedora Silverblue) gives a "WARN SelfTest" at the end of installation. I am currently using Bluefin 38 (non DX edition).

 WARN SelfTest([ShellFailed { shell: Fish, command: "\"fish\" \"-ic\" \"nix build --no-link --expr \\'derivation { name = \\\"self-test-fish-1710192831326\\\"; system = \\\"x86_64-linux\\\"; builder = \\\"/bin/sh\\\"; args = [\\\"-c\\\" \\\"echo hello > \\\\$out\\\"]; }\\'\"", output: Output { status: ExitStatus(unix_wait_status(32512)), stdout: "", stderr: "fish: Unknown command: nix\nfish: \nnix build --no-link --expr 'derivation { name = \"self-test-fish-1710192831326\"; system = \"x86_64-linux\"; builder = \"/bin/sh\"; args = [\"-c\" \"echo hello > \\$out\"]; }'\n^~^\n" } }])
Nix was installed successfully!

Full details in nix_install_log.txt.


After this, the nix commands (e.g. nix-shell) are not available to me, even after reopening my terminal or rebooting. If I manually run . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish - then Nix appears to work fine. I guess the problem is a failure to amend my Fish shell configuration? :shrug:

redbeardymcgee commented 1 month ago

I'm running into this problem also. I was previously testing devbox out using nix-installer from this repo and it was working great. But I don't think I want to keep using a wrapper tool, so i removed all that and restarted with just the nix-installer.

I receive the error from this issue exactly as stated by @pauldoo .

I don't know why it's trying to invoke fish. I leave bash as my login shell for POSIX reasons, and inherit that environment by launching exec fish ... later.

source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish fixes it, but i thought . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh was meant to be included in my bash startup by the installer. This would inherit just fine for me in fish (or I could just keep using bash, same difference) and I actually prefer it personally.

For now, I've added this to my .bashrc:

. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
if [[ $(ps --no-header --pid=$PPID --format=comm) != "fish" && -z ${BASH_EXECUTION_STRING} ]]
then
  shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
  exec fish $LOGIN_OPTION
fi

I'm using home-manager to do this, but I snipped the absolute paths to the executables here.

However, the solution feels wrong, mostly because I did not need to do this yesterday.