Nix: Error while installing, setting up build environment

Created on 21 Jun 2020  路  3Comments  路  Source: NixOS/nix

Describe the bug

I ran curl -L https://nixos.org/nix/install | sh as instructed on the installation page, but was met with this error:

error: while setting up the build environment: getting attributes of path '/nix/store/ily14d68xl11cnbbkf9svwnzwsrrnzah-bash-4.4-p23/bin/bash': No such file or directory
/tmp/nix-binary-tarball-unpack.zfKu3ToCpt/unpack/nix-2.3.6-x86_64-linux/install: unable to install Nix into your default profile

I ran the command without sudo, then removed ~/.nix-profile, ~/.nix-defexpr/ and /nix/, and tried again with sudo, got the same error.

Steps To Reproduce

  1. Run sudo curl -L https://nixos.org/nix/install | sh
  2. See error

Expected behavior

I expected nix to be installed.

nix-env --version output

None. It's not installed.

Additional context

I'm on Arch. While creating this issue I realized there's a slight outdated package for nix in the aur, I haven't tried that as yet as I expected the official installation method to work fine.

bug

Most helpful comment

I just hit the same issue - uninstalling (removing /nix and ~/.nix-*) and reinstalling via the curl installer hit the same error as you posted. In my case, the extra files to delete/uninstall were in /etc/nix - after removing those and running the curl installer, a new shell finally runs nix properly again.

All 3 comments

I installed nix from the aur, and attempted to install home-manager. Running nix-channel --update gave the same error as above.

I figured this out. Turns out I had some configuration files laying around in /root/nix/ that might have been getting in the way. Removing those, and starting from scratch allowed me to install the official way.

I just hit the same issue - uninstalling (removing /nix and ~/.nix-*) and reinstalling via the curl installer hit the same error as you posted. In my case, the extra files to delete/uninstall were in /etc/nix - after removing those and running the curl installer, a new shell finally runs nix properly again.

Was this page helpful?
0 / 5 - 0 ratings