Skip to content
Cachix

Pushing to Cachix

There are different ways to push store paths to Cachix.

These instructions assume your binary cache is called mycache.

Terminal window
$ nix-build | cachix push mycache
Terminal window
$ nix-store -qR --include-outputs $(nix-store -qd $(nix-build)) \
| grep -v '\.drv$' \
| cachix push mycache
Terminal window
$ nix-build shell.nix -A inputDerivation \
| cachix push mycache
Terminal window
$ nix path-info --all | cachix push mycache
Terminal window
$ cachix watch-store mycache

Push all store paths produced during a command

Section titled “Push all store paths produced during a command”
Terminal window
$ cachix watch-exec mycache -- nix-build --max-jobs 4

Assuming you’re familiar with Flakes.

As flake inputs are downloaded from the internet, they can disappear. Copying them over to Cachix saves you from that day.

Terminal window
$ nix flake archive --json \
| jq -r '.path,(.inputs|to_entries[].value.path)' \
| cachix push mycache

To push runtime closure of the default package in a Flake:

Terminal window
$ nix build --no-link --print-out-paths \
| cachix push mycache

To push runtime closure of any set of packages in a Flake:

Terminal window
$ nix build --no-link --print-out-paths .#package-a .#package-b \
| cachix push mycache

Note: to build all packages, leave a thumbs up on NixOS/nix#7165.

Terminal window
$ nix develop --profile dev-profile -c true
$ cachix push mycache dev-profile