Open jvns opened 1 year ago
I had the same problem with bad meta.outputsToInstall. I couldn't install or uninstall anything, and the script you linked to didn't work either, but I found this and that helped me. Don't know why though and I don't know what I did to end up with this error.
I had (and still have) the exact same issue with nix (Nix) 2.13.5
in docker. This is quite annoying, no topic nor any issue seems to properly address the root cause of this situation.
It seems some packages install tend to trigger it more than others (for me an good example is nixpkgs.dog
) but I'm not even sure this is correlated.
TL;DR there are 2 workaround hacks:
nix-env -u --always
OR
nix-env --list-generations
nix-env --rollback
I'm still on the Nix learning phase tho, maybe this is just a normal behavior that is out of my understanding for some reason.
Edit: FYI I'm using channel nixpkgs-unstable
but I had the exact same issue with Nix 2.11.1
and channels 22.05
I also stumbled upon this problem and have a Dockerfile
to reproduce it.
FROM nixos/nix:2.24.9
RUN nix-env -iA nixpkgs.gnused
RUN nix-env -iA nixpkgs.crane
RUN nix-env -iA nixpkgs.devenv
On my PC this always leads to: error: this derivation has bad 'meta.outputsToInstall'
for the devenv
package.
Interestingly, this doesn't happen if I change the order:
FROM nixos/nix:2.24.9
RUN nix-env -iA nixpkgs.devenv
RUN nix-env -iA nixpkgs.gnused
RUN nix-env -iA nixpkgs.crane
This builds without problems. The used build command is: docker build -t nix-test .
Maybe somebody can have a look into this to see why the environment breaks.
Maybe I found something that could help debugging this issue. After installing crane
, which seems to break nix-env
, I looked into the manifest.nix
and found this:
[
{
crane = ...
meta = {
outputsToInstall = ["out"];
};
outputs = ["crane"];
}
...
]
As you can see, the meta.outputsToInstall
doesn't match the outputs
list. Other packages that don't break nix-env
like jq
and gnused
have matching values.
Describe the bug
Sometimes when I run
nix-env -iA nixpkgs.somepackage
, I get abad meta.outputsToInstall
error, like this:It happens when I try to install any package -- nix is just completely broken.
This happens every 2-3 months with no obvious-to-me pattern. The only way I know to fix it is to run this bash script, which always fixes the problem. I don't understand what that script does though.
Steps To Reproduce
I don't know, but I know it's happened to me repeatedly. Reporting it in case someone else can figure out how to reproduce it or is running into the same issue.
Expected behavior
It seems weird that I need to do a seemingly stateful thing like "rebuild my profile" since nix is supposed to be stateless -- it's surprising to me that the system just breaks for no apparent reason every few months.
nix-env --version
output