# Introduction 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`. # History 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.