NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.3k stars 1.49k forks source link

nix-daemon doesn't have access to nix binaries in non-NixOS multi-user installation #4902

Open flokli opened 3 years ago

flokli commented 3 years ago

Describe the bug

When installing Nix on a non-NixOS system (in multi-user mode, which is the default now), the nix-daemon doesn't have the nix* binaries in $PATH.

This is somewhat unintuitive/inconsistent, as nix.package gets added to $PATH on NixOS, and it just works there, but fails for example when using Nix on non-NixOS (like in a GitHub Action)

Steps To Reproduce

  1. Install Nix on non-NixOS via the official installer
  2. Configure a post-build-hook via nix.conf
  3. In the post-build-hook, invoke a nix binary (like nix copy as per https://www.tweag.io/blog/2019-11-21-untrusted-ci/)
  4. Nix is unable to invoke these binaries

Expected behavior

nix-daemon has its tooling in $PATH.

nix-env --version output 2.3.12, as per

      - uses: cachix/install-nix-action@v13

Additional context

Originally reported as https://github.com/cachix/install-nix-action/issues/82, but it's not limited to the install-nix-action itself, and the case in everything using the installer on non-NixOS.

abathur commented 3 years ago

(in multi-user mode, which is the default now)

Probably doesn't alter the issue any, but adding errata for posterity:

flokli commented 3 years ago

True, cachix configures the installer to multi-user. I assume the problem is also present on MacOS, even though I didn't explicitly check for it.

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

adrian-gierakowski commented 11 months ago

related: https://github.com/DeterminateSystems/nix-installer-action/issues/54