Manual download packages vs garbage collection

I’ve come across a few packages where, mostly for license reasons, nixos-rebuild will stop and complain that the download package has to be manually downloaded and added to the nix store.

This is obviously inconvenient, but I can see why it’s perhaps a problem tooling cannot solve alone. Let’s just stipulate that this is necessary, for now.

However, there is also a tooling problem. After a garbage-collect, the downloaded files are no longer in the store, and the whole cycle repeats again. Is there some way we can add these dependencies so they’re not garbage-collected, and can avoid manual downloads at least until the next version upgrade?

1 Like

I think you’re looking for nix-store --add-fixed, but be aware those won’t ever be garbage collected, so that will be on you if the package is updated.

1 Like

That’s useful, but I was at least hoping for a way to have the system recognise the dependency at garbage-collection time, in the same way it does at install time moments later.

I think setting keep-outputs and keep-derivations to true in nix.conf should do the trick. You will keep the build dependencies of everything on your system.

2 Likes

I think you may be correct, and that this is a thing I want generally - I get a lot of repeated downloads of rust things when I nix develop, and I think it’s at least partially the same cause (though some are more frequent updates)