I frequently copy and paste default.nix files around when creating custom packages, and it occurred to me several times already that I leave the sha256 of a previous default.nix.
In that case, when the sha256 is wrong bu correspond to some other existing package, I’ve noticed that nix-env behave strangely, pretending to install the new package but actually trying to install the previous one.
A good way to obtain the “correct” behavior (which is to fail to download the new package because the sha256 does not match the one of the default.nix) seems to do a nix-collect-garbage
.
I therefore suspect that the sha256 is looked for in the /nix/store and “trusted” regardless of the actual package name, or something like that.
That’s very confusing the first few times this happen.
Can something be done about this ?