pkgs.mkBinaryCache

pkgs.mkBinaryCache is a function for creating Nix flat-file binary caches. Such a cache exists as a directory on disk, and can be used as a Nix substituter by passing --substituter file:///path/to/cache to Nix commands.

Nix packages are most commonly shared between machines using HTTP, SSH, or S3, but a flat-file binary cache can still be useful in some situations. For example, you can copy it directly to another machine, or make it available on a network file system. It can also be a convenient way to make some Nix packages available inside a container via bind-mounting.

mkBinaryCache expects an argument with the rootPaths attribute. rootPaths must be a list of derivations. The transitive closure of these derivations’ outputs will be copied into the cache.

Optional arguments

compression ("none" or "xz" or "zstd"; optional)

The compression algorithm to use.

Default value: zstd.

[]{#sec-pkgs-binary-cache-example}