It is possible to mirror a nix binary cache using the nix
command line tool using a command sucn as:
xzcat store-paths.xz | nix copy --from https://cache.nixos.org --to file:///path/to/where/the/mirror/should/end/up
where store-paths.xz is a file containing the store-paths of all binaries in the cache, e.g. https://channels.nixos.org/nixos-unstable/store-paths.xz
However that command will use a lot of system resources since it will unpack all of the downloaded files and repack them before writing them to disk (if I have understood the reasons for the high cpu usage correctly).
Make sure to have openssl and pkg-config installed and run cargo build
.
If using nix you can use the provided shell.nix
which is only a symlink to
default.nix
to get the dependencies.
Run nix-build
as usual.
nix-mirror --help
to show application helpnix-mirror store-paths.xz ./mirror
to download all the archives in
store-paths.xz
and their transitive dependencies to the directory ./mirror
.Licensed under either of
at your option.