Home-manager: Error when running `nix-env -qa`

Created on 24 Dec 2018  ·  13Comments  ·  Source: nix-community/home-manager

Since today, I get this error:

❯ nix-env -qa
error: cannot import '/nix/store/zsfkn004z6sdfmkwvxf7jpkrw64fjh9y-source', since path '/nix/store/2djwy3xymwh3890i1id73217144l8vas-source.drv' is not valid, at /nix/store/601wfd2qdr03mpj08cd4qr9lha7d63s4-home-manager-18.09/home-manager/tests/default.nix:14:1

I tried activating a previous generation, but that didn't help.

  • NixOS 18.09
  • HM 18.09

Most helpful comment

Sorry for the late action on this. Hopefully the issue is resolved now! Please reopen if not.

All 13 comments

Hmm, that's an odd error. Could you attach the /nix/store/2djwy3xymwh3890i1id73217144l8vas-source.drv file in a comment? You could also try running

$ nix show-derivation /nix/store/2djwy3xymwh3890i1id73217144l8vas-source.drv
{
  "/nix/store/2djwy3xymwh3890i1id73217144l8vas-source.drv": {
    "outputs": {
      "out": {
        "path": "/nix/store/zsfkn004z6sdfmkwvxf7jpkrw64fjh9y-source",
        "hashAlgo": "r:sha256",
        "hash": "d58c1ce255bcacfaffcc339cfd8ec89290f487a996cbbc5e51bc3bd58b250ae6"
      }
    },
    "inputSrcs": [
      "/nix/store/qjk2h301faawvbnhv5azhyiaw6vrqalg-builder.sh"
    ],
    …
  }
}

Oh, and you can try nix-env -f '<nixpkgs>' -qa. I just played around with this and there seems to be some oddity with the nix-env -qa command. For me I get

rycee@beta:~$ nix-env -qa
home-manager
home-manager-install
rycee@beta:~$ nix-env -f '<nixpkgs>' -qa | head
2048-in-terminal-2017-11-29
20kly-1.4
2bwm-0.2
389-ds-base-1.3.5.19
3dpong-0.5
8086tiny-1.25
90secondportraits-1.01b
915resolution-0.5.3
98ec0eee2ddef5d4a00e2ac4a95e8add46d23b69.tar.gz
9pfs-20150918

Hmm, that's an odd error. Could you attach the /nix/store/2djwy3xymwh3890i1id73217144l8vas-source.drv file in a comment

It does not exist :man_shrugging:

nix-env -f '<nixpkgs>' -qa seems to work fine, thanks! Is this something that should be fixed in HM?

I'm not sure my problem is necessarily due to HM though.

FWIW this is happening to me, too, on a relatively fresh nix setup. It worked fine until I ran nix-collect-garbage, though, which may or may not be related. Thanks for the -f workaround; I can use home-manager and nixos-rebuild just fine now. Let me know if I can share some information that could be useful.

I think my error too popped up after collecting garbage.

Affected as well. I cannot say when the problem started to appear though, as this was the first time in several months I ran nix-env.

Just installed home-manager on a new NixOS install, same issue.

I just created my first generation, first I ran build then on switch I get this error:

[asthma@dev:~]$ home-manager switch
/nix/store/7qwgxl78cix3y0jd1z8sllfnh71hmwbj-home-manager-generation
Starting home manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
building '/nix/store/i2vxlbdn9399cyasac0agc92633c2im4-user-environment.drv'...
error: packages '/nix/store/ignrjsw1bjji6qybmn4bd4h58ylb5ckj-home-manager-path/share/kxmlgui5/gvpart/gvpart.rc' and '/nix/store/a764d2md8nky868dmrms9b3im7cy2aji-gwenview-18.08.0/share/kxmlgui5/gvpart/gvpart.rc' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
builder for '/nix/store/i2vxlbdn9399cyasac0agc92633c2im4-user-environment.drv' failed with exit code 1
error: build of '/nix/store/i2vxlbdn9399cyasac0agc92633c2im4-user-environment.drv' failed

This error was because I had installed packages with nix-env -iA package but also defined it in the home-manager configuration.

@ivegotasthma you mean that the nix-env -qa error is due to the package being installed declaratively and imperatively?

I thought getting into that state was actually not possible.

@asymmetric The -qa error is due to something else. I wanted to say that I fixed this issue:

error: packages '/nix/store/ignrjsw1bjji6qybmn4bd4h58ylb5ckj-home-manager-path/share/kxmlgui5/gvpart/gvpart.rc' and '/nix/store/a764d2md8nky868dmrms9b3im7cy2aji-gwenview-18.08.0/share/kxmlgui5/gvpart/gvpart.rc' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)

by removing the imperatively installed packages and using declaratively ones only.

I confirm this as well. Adding the repo, installing and using works fine - until you run garbage collect, then it starts complaining about the missing .drv file.

Removing home-manager and its repo makes nix-env work again.

Another workaround would be to run "nix-env -u", which would install some additional packages:

`% nix-env -u
copying path '/nix/store/s6ylb9gik42iq364fvmi8wgi9hk6jh79-mirrors-list' from 'https://cache.nixos.org'...
copying path '/nix/store/z5nrzfhna5hkccnxhsqracq3clysb7xd-c-ares-1.15.0' from 'https://cache.nixos.org'...
copying path '/nix/store/4bjsh3zmx7kjydn8mz55lkay2sh407my-libev-4.24' from 'https://cache.nixos.org'...
copying path '/nix/store/960cxwf23k9hf45mpi8phy35xgqrbcm7-libkrb5-1.15.2-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/df9vw3lmjhfh7f5f87vhrfkkq3lph8f2-libssh2-1.8.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/yjrblkcmsh2w8scsdbri051g5nvm9693-nghttp2-1.35.1' from 'https://cache.nixos.org'...
copying path '/nix/store/28m5ga92m4h7xb1abnknq2hhhvfgjy22-stdenv-linux' from 'https://cache.nixos.org'...
copying path '/nix/store/p92ybn520n3xly12azlvr6szm6hb6fcb-nghttp2-1.35.1-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/5hinakkslbilcjbvjcv92znl4sr39nl7-nghttp2-1.35.1-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/ypw8b4cqk2pqyr16mdsp0lp1harvc7in-curl-7.63.0-dev' from 'https://cache.nixos.org'...
building '/nix/store/92zha3mkja8x7ak6xf11c6hqabzaswfc-source.drv'...

trying https://gitlab.com/api/v4/projects/rycee%2Fnmt/repository/archive.tar.gz?sha=b6ab61e707ec1ca3839fef42f9960a1179d543c4
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3145 100 3145 0 0 4898 0 --:--:-- --:--:-- --:--:-- 4898
unpacking source archive /build/archive.tar.gz?sha=b6ab61e707ec1ca3839fef42f9960a1179d543c4
`

Sorry for the late action on this. Hopefully the issue is resolved now! Please reopen if not.

This is the error I get now:

❯ nix-env -Paq vim
error: cannot import '/nix/store/hw3njcsd1549ing29mjy7rk81fzigsn4-source', since path '/nix/store/9l4wsxnwbyyljshhckcvigj06q25gxp5-source.drv' is not valid, at /nix/store/jphbd4yg2spmi262w6qhm24dz3ib7185-nixos-18.09.2337.5d972dd2c94/nixos/lib/customisation.nix:110:45

❯ nix-env -Paq vim -f '<nixpkgs>'
error: cannot import '/nix/store/hw3njcsd1549ing29mjy7rk81fzigsn4-source', since path '/nix/store/9l4wsxnwbyyljshhckcvigj06q25gxp5-source.drv' is not valid, at /nix/store/jphbd4yg2spmi262w6qhm24dz3ib7185-nixos-18.09.2337.5d972dd2c94/nixos/lib/customisation.nix:110:45
Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonathanReeve picture JonathanReeve  ·  8Comments

rschulman picture rschulman  ·  5Comments

loewenheim picture loewenheim  ·  7Comments

throwup picture throwup  ·  6Comments

dermetfan picture dermetfan  ·  6Comments