I ran the recommended installation script of nix
on my ARM macOS 13.2.1 machine:
curl -L https://nixos.org/nix/install | sh
The installation completed successfully, no errors, nothing.
I made sure to start a new terminal.
When I run the equivalent of nix's Hello World, I get an error:
$ nix-env -iA nixpkgs.hello
error: attribute 'nixpkgs' in selection path 'nixpkgs.hello' not found
nix --version
returns nix (Nix) 2.14.1
.
Trying out a nix-shell
Hello World fails with:
$ nix-shell -p nix-info --run "nix-info -m"
error:
… <borked>
at «none»:0: (source not available)
… while calling the 'import' builtin
at «string»:1:18:
1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (nix-info) ]; } ""
| ^
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
Some SO answers recommended
$ nix-env --install
building '/nix/store/xsk9wjy0dpp7w7d3r3bkzxzaklqdzq6q-user-environment.drv'...
and
$ nix-channel --update
unpacking channels...
Neither helped.
nix-env -qaP
Returns with exit 0 but no output.
Not sure what I could have possibly done wrong. I didn't run using sudo
- but it also didn't recommend. I was asked for my password once. I used zsh 5.9
. I have rosetta 2
installed.
There was one thing in the log that puzzled me: it said that chmod
of /nix/.Trashes
failed. But the installation completed successfully, so is that it?
Here's ls -alht /nix
:
$ lsa /nix
total 0
drwxrwxr-t 73 root nixbld 2.3K 7 Mar 04:12 store
drwxr-xr-x 5 root nixbld 160B 7 Mar 03:55 .
drwxr-xr-x 4 root nixbld 128B 7 Mar 03:55 var
d-wx--x--t 3 root wheel 96B 7 Mar 03:54 .Trashes
What shall I do? It's hard to miss the irony of being unable to install a build system that promises deterministic builds.
Edit: This answer from yesterday (!) worked for me! I didn't try it at first because I didn't like adding an unstable channel. But apparently that's what was required. Maybe the stable channel is down?
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
Edit 2: It's a known issue, from 2.14.0, attempted fix in 2.14.1 seems to not have worked: https://github.com/NixOS/nix/issues/7937