I cannot install any packages because building user environment fails each time.
The same error occurs when I try to nix-channel --update
$ nix-env -iA nixpkgs.hello
installing 'hello-2.10'
these paths will be fetched (0.04 MiB download, 0.19 MiB unpacked):
/nix/store/6mab2znnw7j96k3vsdw9vyckady29r46-hello-2.10
copying path '/nix/store/6mab2znnw7j96k3vsdw9vyckady29r46-hello-2.10' from 'https://cache.nixos.org'...
building '/nix/store/7i606nrnh2hyrpri4xmqvs6jnyn67qph-user-environment.drv'...
error: unsupported builtin function 'buildenv'
builder for '/nix/store/7i606nrnh2hyrpri4xmqvs6jnyn67qph-user-environment.drv' failed with exit code 1
error: build of '/nix/store/7i606nrnh2hyrpri4xmqvs6jnyn67qph-user-environment.drv' failed
Please run nix-shell -p nix-info --run "nix-info -m"
and paste the
results.
$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 4.14.43, NixOS, 18.09pre140920.5b468ea6b1d (Jellyfish)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.1pre6148_a4aac7f`
- channels(pan): `"nixpkgs-18.09pre140731.c29d2fde74d"`
- channels(root): `"nixos"`
- nixpkgs: `/home/pan/.nix-defexpr/channels/nixpkgs`
This happens because the client version is newer than the nix-daemon version.
Not sure if this related or not. nix-env
also failed on my system but I've got different message.
~~~~
[wizzup@ ~]$ nix-env -qa | grep -i hello
error: attribute 'callPackage' missing, at /nix/store/d2nk7k1rr1rv5ai9hwzssvy6gkxsknmn-nixos/nixos/pkgs/applications/altcoins/default.nix:76:11
[wizzup@ ~]$ nix-env -i hello
error: attribute 'callPackage' missing, at /nix/store/d2nk7k1rr1rv5ai9hwzssvy6gkxsknmn-nixos/nixos/pkgs/applications/altcoins/default.nix:76:11
[wizzup@ ~]$ nix-channel --list
[wizzup@ ~]$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-unstable
[wizzup@ ~]$ nix-shell -p nix-info --run "nix-info -m"
"x86_64-linux"
Linux 4.14.43, NixOS, 18.09pre-git (Jellyfish)
yes
no
nix-env (Nix) 2.0.2
"nixos"
""
/nix/var/nix/profiles/per-user/root/channels/nixos
~~~~
Uninstalling nixUnstable
did the trick.
(Actually, removing nixUnstable
by nix-env -e
failed due to the same error, so I rolled back to the very first generation and reinstalled every package except nixUnstable
)
@wizzup That's not good! Has "haskellPackages.callPackage" been removed? It's still used in a few places.
/cc @peti
@matthewbauer Only nix-env
seem to have problem. I still can use nix-shell
and nixos-rebuild
. Should I open a new issue?
~~~~
[wizzup@ ~]$ nix-shell -p hello
[nix-shell:~]$ which hello
/nix/store/84sxm540ssjq9k98xdcwc6hw6mrx972k-hello-2.10/bin/hello
[nix-shell:~]$ exit
[wizzup@ ~]$ nix-env -i hello
error: attribute 'callPackage' missing, at /nix/store/d2nk7k1rr1rv5ai9hwzssvy6gkxsknmn-nixos/nixos/pkgs/applications/altcoins/default.nix:76:11
[wizzup@ ~]$ nix-build '
/nix/store/84sxm540ssjq9k98xdcwc6hw6mrx972k-hello-2.10
~~~~
I'm closing this as my problem is solved. Please open another one.
This happens because the client version is newer than the nix-daemon version.
Probably worth noting that if you have this problem on OSX (like I did) then the following will reload the nix-daemon
sudo launchctl unload -w /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo launchctl load -w /Library/LaunchDaemons/org.nixos.nix-daemon.plist
The fix for me whas to use sudo nix-env -i
instead of nix-env -i
.
Got the hint from https://discourse.nixos.org/t/is-nix-channel-update-broken-in-nix-2-1-on-darwin/873/3.
Most helpful comment
Probably worth noting that if you have this problem on OSX (like I did) then the following will reload the
nix-daemon