Frequently Asked Questions¶
What Nix versions are supported?¶
Cachix supports Nix 2.0.2 or higher. Nix 2.3.5 or higher is recommended.
Does pushing a store path override an existing entry?¶
No. The existing entry first needs to be deleted.
Are entries immediately available after they are pushed?¶
Yes. See the next questions what might happen to seem otherwise.
Why is Nix not picking up on any of the pre-built artifacts?¶
For example, given that
/nix/store/spznih45c56kfwygx8qyq1skd1rs4zv1-myproject-1.0.0 is missing,
check if store path exists in the binary cache:
$ curl https://mycache.cachix.org/spznih45c56kfwygx8qyq1skd1rs4zv1.narinfo
If the entry exists:
It is possible that you need to restart
nix-daemonto pick up
sudo pkill nix-daemon.
If you ran
nix-buildbefore binary cache has been populated, Nix will maintain a negative cache for the entry.
Substitution could be disabled for that derivation via
allowSubstitutes = false;attribute.
On NixOS, it’s a known limitation that you first need to add cachix configuration and run
nixos-rebuild switchand only after the next run of
nixos-rebuild switchbinary caches would be used.
If the entry does not exists:
Check if the entry that you expected has a different hash.
You can compare the difference between two derivations via
nix-shell -p nix-diff --run "nix-diff drv1 drv".
In order to have both derivations available locally you can run
nix-instantiate default.nix | cachix push mycacheto push the dervation into Cachix and then run
nix-store -r /nix/store/hash.drvto retrieve it on another machine.
Common reason for derivation hash differences are described in language anti-patterns.
cachix pushgot interrupted and the whole dependency tree is not available from Cachix. In that case push again retry to make sure everything is uploaded.
If the same store hash is available in https://cache.nixos.org it will count as existing upstream and won’t be present in cachix
Is there a way to cache
Many of CI integrations will push everything that was built during the CI run. Otherwise you can do the following.
Make sure shell dependencies are built:
$ nix-shell --run "echo OK"
Push to cachix:
$ nix-store --query --references $(nix-instantiate shell.nix) | xargs nix-store --realise | xargs nix-store --query --requisites | cachix push mycache
How to disable binary caches when working offline?¶
--option substitute false to Nix commands.
What happens when I run cachix use (both immediately and any stateful effects for the future)?¶
It will modify
nix.conf and append substituters and trusted-public-keys.
If you’re using NixOS, it will write NixOS configuration.
If you’re a trusted-user it will append to ~/.config/nix/nix.conf.
Otherwise it will either fail in case configuration cannot be written or it will append to /etc/nix/nix.conf.