I know I can just run it with a wrong hash. Is there any way to do that in a script? I thought nix-prefetch-url doesn’t support extraPostFetch.
Did you try the --unpack
option?
Yes, I did. How can I use it with extraPostFetch?
Right, nix-prefetch-url --unpack
can only work for common fetchzip
without extraPostFetch
, as there is no way to pass that data to the utility.
Depending on the use case, I usually just change the hash to all zeroes (or an empty string on newer Nix) and Nix will tell me the correct hash. Then I change the hash to the printed one manually.
Other times, especially when updating a package, I use update-source-version
from common-updater-scripts
, which changes the hash in the Nix expression for me to one corresponding to the given version.
Then there is nix-prefetch
from the eponymous package should do what nix-prefetch-url
does but takes the data from an attribute so it should support extraPostFetch
. I have no experience with that, as I prefer to rely on manual TOFU or update-source-version
.
Thanks for your tips!
I’d try nix-prefetch-url -A the-attribute.path.that-you-want-to-fetch
.
EDIT: oh, the option isn’t documented in man nix-prefetch-url