Go to file
Solene Rapenne edfbbead39 name in LICENSE 2022-11-03 20:03:49 +01:00
LICENSE name in LICENSE 2022-11-03 20:03:49 +01:00
README.md README: PR got merged, still mention it for older nixpkgs 2022-11-03 20:03:04 +01:00
mirror.pl nix-instantiate can be used to replace nix-instantiate + nix-build 2022-09-01 09:22:23 +02:00
run.sh nixpkgs should be the one provided in the command line 2022-08-31 17:37:26 +02:00



The point of this script is to allow users to locally download all sources required to build a given Nix package.

The script relies on internal Nixpkgs tools that will download the sources in the nix store and verify the checksum.

If you run it multiple times, nothing more will be downloaded but it takes a bit of time to ensure each file is in the store.

Avoiding garbage collector

Files will be downloaded into the nix store, and linked into a newly created directory distfiles relative to your current location.

The link prevents the files to be garbage collected.

How to use

To download sources required to build git:

./run.sh git kakoune | ./mirror.pl

To download sources required to build git and mercurial:

./run.sh git mercurial | ./mirror.pl

To download sources required to build git using a different nixpkgs:

./run.sh -f /path/to/nixpkgs/ git | ./mirror.pl

Internal details

The command run.sh is printing a JSON file on stdout containing each source information such as url, checksum value, checksum type, filename.

The command mirror.pl is reads a JSON structure on the standard input and will loop over each item.

By using this design, you can craft JSON files with custom scripts, and feed them to mirror.pl.


Patches files weren't included before the merge of https://github.com/NixOS/nixpkgs/pull/188626 , so if you want to run it on older nixpkgs versions, you won't have the patches files, the diff is trivial to be applied though.