I would like to be able to download distfiles used in nixpkgs in bulk to have them locally. I can’t find how to achieve that. I tried with nix repl to find where I could get the source file of a derivation, but it doesn’t seem available.
As for the repl, I looked at a few packages and they didn’t have a .src attribute, so this doesn’t seem consistent?
So far, I found a way to generate a package list with nix search . --json | jq -r 'keys|.[]' and https://github.com/msteen/nix-prefetch can be used to output the urls of each package, unfortunately nix-prefetch also download to compute the hash, without keeping the file. I’m trying to either make it only display the url OR keep the file, but it doesn’t seem to provide any of these two features.
It kinda works but for some reasons, the find-tarballs.nix code seems to miss some patches files.
I downloaded all the distfiles required for nethack and it fails to build
> nix-build --option substitute false -A nethack
these 2 derivations will be built:
/nix/store/8yzb0i8k00a82p64zli2vv90a23hhj41-81d73ce417dda6a98e2e918e06922e68b67c53f7.patch.drv
/nix/store/snjr06jvd25v0i9367rdparq1i38lv1l-nethack-3.6.6.drv
building '/nix/store/8yzb0i8k00a82p64zli2vv90a23hhj41-81d73ce417dda6a98e2e918e06922e68b67c53f7.patch.drv'...
error checking the existence of https://tarballs.nixos.org/sha256/sha256-PX9XtJTEE3K1yg/IwIzEIT+EZWi02gU+9msrsG9ZWQY=:
curl: (6) Could not resolve host: tarballs.nixos.org
trying https://github.com/NetHack/NetHack/commit/81d73ce417dda6a98e2e918e06922e68b67c53f7.patch
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com
Warning: Problem : timeout. Will retry in 1 seconds. 3 retries left.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com
Warning: Problem : timeout. Will retry in 2 seconds. 2 retries left.
curl: (6) Could not resolve host: github.com
Warning: Problem : timeout. Will retry in 4 seconds. 1 retries left.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com
error: cannot download 81d73ce417dda6a98e2e918e06922e68b67c53f7.patch from any mirror
error: builder for '/nix/store/8yzb0i8k00a82p64zli2vv90a23hhj41-81d73ce417dda6a98e2e918e06922e68b67c53f7.patch.drv' failed with exit code 1;
last 10 log lines:
> % Total % Received % Xferd Average Speed Time Time Time Current
> Dload Upload Total Spent Left Speed
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com
> Warning: Problem : timeout. Will retry in 1 seconds. 3 retries left.
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com
> Warning: Problem : timeout. Will retry in 2 seconds. 2 retries left.
> curl: (6) Could not resolve host: github.com
> Warning: Problem : timeout. Will retry in 4 seconds. 1 retries left.
> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com
> error: cannot download 81d73ce417dda6a98e2e918e06922e68b67c53f7.patch from any mirror
For full logs, run 'nix log /nix/store/8yzb0i8k00a82p64zli2vv90a23hhj41-81d73ce417dda6a98e2e918e06922e68b67c53f7.patch.drv'.
error: 1 dependencies of derivation '/nix/store/snjr06jvd25v0i9367rdparq1i38lv1l-nethack-3.6.6.drv' failed to build
The missing file isn’t reported by find-tarballs.nix
Oh! I was using some examples which were relying on an unwrapped package. I found the urls attribute then. But now, I need to find the url for patches when there are any…