Pushing to Cachix
There are different ways to push store paths to Cachix.
These instructions assume your binary cache is called mycache.
Pushing runtime dependencies
Section titled “Pushing runtime dependencies”$ nix-build | cachix push mycachePushing build and runtime dependencies
Section titled “Pushing build and runtime dependencies”$ nix-store -qR --include-outputs $(nix-store -qd $(nix-build)) \ | grep -v '\.drv$' \ | cachix push mycachePushing shell environment
Section titled “Pushing shell environment”$ nix-build shell.nix -A inputDerivation \ | cachix push mycachePushing whole /nix/store
Section titled “Pushing whole /nix/store”$ nix path-info --all | cachix push mycachePushing all newly built store paths
Section titled “Pushing all newly built store paths”$ cachix watch-store mycachePush all store paths produced during a command
Section titled “Push all store paths produced during a command”$ cachix watch-exec mycache -- nix-build --max-jobs 4Flakes
Section titled “Flakes”Assuming you’re familiar with Flakes.
Pushing flake inputs
Section titled “Pushing flake inputs”As flake inputs are downloaded from the internet, they can disappear. Copying them over to Cachix saves you from that day.
$ nix flake archive --json \ | jq -r '.path,(.inputs|to_entries[].value.path)' \ | cachix push mycachePushing runtime closure
Section titled “Pushing runtime closure”To push runtime closure of the default package in a Flake:
$ nix build --no-link --print-out-paths \ | cachix push mycacheTo push runtime closure of any set of packages in a Flake:
$ nix build --no-link --print-out-paths .#package-a .#package-b \ | cachix push mycacheNote: to build all packages, leave a thumbs up on NixOS/nix#7165.
Pushing shell environment
Section titled “Pushing shell environment”$ nix develop --profile dev-profile -c true$ cachix push mycache dev-profile