nix icon indicating copy to clipboard operation
nix copied to clipboard

NIX on SteamOS cannot set up environment properly.

Open cammelspit opened this issue 6 months ago • 3 comments

Describe the bug

NIX package manager refuses to work properly on SteamOS 3.7.8. Immediately after installation it did indeed work but after it working once, closing the terminal and opening it again as a sanity check, nix will no longer run even after sourcing the environment manually.

Steps To Reproduce

  1. Freshly installed SteamOS 3.7.8 from the live environment with no other modifications or software installed except for oh my ZSH and the zulu plugin manager.
  2. Install NIX package manager in multi user mode. '$ sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemon' taken directly from nixos.org.
  3. close terminal and reopen to verify working nix install.

Expected behavior

Output something like this

cammelspit@archlinux ~ ❯❯❯ nix --version nix (Nix) 2.29.0

Metadata

The output I actually receive after exactly one successful test where I got an expected output.

deck@steamdeck ~ ❯❯❯ nix --version zsh: command not found: nix

Additional context

I am basically stuck here since I don't really know enough more about NIX to move forward from here. I use NIX so i can install some basic stuff and I have been using it on SteamOS since I got my Steam Deck a handful of years ago. For some reason, even though it works once, it stops and even after wiping my deck, I just seem to be unable to get it working again. I have done a good bit of faffing about with NIX on the deck over the last few years and I have never run across this issue, at least since Valve gave us /nix to use as a mount point and the official installer supported SteamOS.

Checklist


Add :+1: to issues you find important.

cammelspit avatar Jun 12 '25 19:06 cammelspit

My guess is that your full shell profile contains something that is hard-resetting PATH after nix sets up. Try putting a set -x in at the top of /etc/zshrc and restart it so that you can see what it's doing.

abathur avatar Jun 13 '25 00:06 abathur

OK, had some time to fiddle with this a bit more. It seems the script is bailing out early on _ETC_PROFILE_NIX_SOURCED. I tried 'unset __ETC_PROFILE_NIX_SOURCED' and then i ran /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh and it indeed worked!

deck@steamdeck ~ ❯❯❯ which nix echo $PATH

/nix/var/nix/profiles/default/bin/nix /home/deck/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/deck/.zulu/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/flatpak/exports/bin

deck@steamdeck ~ ❯❯❯ nix error: no subcommand specified Try 'nix --help' for more information.

I'll be frank, I have only been using Linux as my main desktop OS for a year and a half so im not sure why it thinks it's already been sourced when it hasn't. I guess it is progress though. I am going to keep fiddling around and if you have any suggestions, lemme know.

cammelspit avatar Jun 17 '25 09:06 cammelspit

Yes--this is one of the symptoms that something in your regular systemwide or user shell init files are hard-setting the PATH after nix sets up, overwriting the path additions (but not other side effects, like setting _ETC_PROFILE_NIX_SOURCED).

abathur avatar Jun 17 '25 12:06 abathur