3

I ended up with the wrong source for a package in my nix store. This happened a while back so I'm not able to track down the log file to figure out how it happened. Any attempts I make to rebuild the same version of the package result in using the same incorrect source. Is there a way to invalidate a source archive or force a re-fetch?

I could mount the store rw and delete the archive, but it seems like there ought to be a solution that doesn't subvert nixos' ro design.

4

You can always nix-store --delete /nix/store/path if you don't keep the path alive by some references, but you should note some details. I assume your sources are obtained by fetchurl or a similar fixed-output derivation. These specify the hash of the output, and the path you have in nix store matches that hash, so it is actually the correct source (considering what you asked of nix).

The typical easy path is to overwrite the hash in fetchurl to some incorrect value, e.g. replace some characters by zeros, and nix will then try to re-fetch and print the resulting (mismatching) hash which you can then update. There's also nix-prefetch-url to avoid doing fetches twice, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.