Skip to content
Cachix

FAQ

First step for any problem: run cachix doctor

Section titled “First step for any problem: run cachix doctor”

See Using the CLI.

If cachix doctor reports everything is healthy and you still see a problem, continue with the questions below.

We test against the current stable Nix release and the most recent NixOS release branches. In practice this means Nix 2.18 (the long-term-support series) or newer. Older Nix versions may still work, but are not actively tested and security fixes will not be backported for them.

Does pushing a store path override an existing entry?

Section titled “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?

Section titled “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?

Section titled “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:

Terminal window
$ curl https://MY_CACHE.cachix.org/spznih45c56kfwygx8qyq1skd1rs4zv1.narinfo

Replace MY_CACHE with your cache name in the examples on this page.

If the entry exists:

  1. It is possible that you need to restart nix-daemon to pick up nix.conf changes. Run sudo pkill nix-daemon.

  2. If you ran nix-build before binary cache has been populated, Nix will maintain a negative cache for the entry.

    See a workaround to remove negative caching.

  3. Substitution could be disabled for that derivation via allowSubstitutes = false; attribute.

  4. On NixOS, it’s a known limitation that you first need to add cachix configuration and run nixos-rebuild switch and only after the next run of nixos-rebuild switch binary caches would be used.

If the entry does not exist:

  1. 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 MY_CACHE to push the derivation into Cachix and then run nix-store -r /nix/store/hash.drv to retrieve it on another machine.

    Common reason for derivation hash differences are described in language anti-patterns.

  2. Maybe cachix push got interrupted and the whole dependency tree is not available from Cachix. In that case push again to make sure everything is uploaded.

  3. If your cache has cache.nixos.org configured as an upstream, Cachix can skip uploading paths already available there. Nix needs that substituter to download them. See Upstreams.

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:

Terminal window
$ nix-shell --run "echo OK"

Push to cachix:

Terminal window
$ nix-store --query --references $(nix-instantiate shell.nix) | xargs nix-store --realise | xargs nix-store --query --requisites | cachix push MY_CACHE

How to disable binary caches when working offline?

Section titled “How to disable binary caches when working offline?”

Pass --option substitute false to Nix commands.

What happens when I run cachix use (both immediately and any stateful effects for the future)?

Section titled “What happens when I run cachix use (both immediately and any stateful effects for the future)?”

See Configuring Nix.

I get InvalidPath error from Nix when invoking Cachix

Section titled “I get InvalidPath error from Nix when invoking Cachix”

There are two cases under which the error is raised:

  • Garbage Collection kicks in while Cachix is trying to push a path. To confirm if that’s the case, check if GC timestamps correlate with when the error was raised
  • Store paths weren’t built yet. Some Nix commands return store paths that would exist if Nix has built them.

warning: ‘https://MY_CACHE.cachix.org’ does not appear to be a binary cache

Section titled “warning: ‘https://MY_CACHE.cachix.org’ does not appear to be a binary cache”

Two causes:

  1. You have mistyped the binary cache name
  2. You didn’t set correct auth token via netrc for a private binary cache. Open https://MY_CACHE.cachix.org with your cache name for instructions.

For API authentication tokens:

Terminal window
$ curl -v -H "Authorization: Bearer ${CACHIX_AUTH_TOKEN}" https://app.cachix.org/api/v1/user

For cache authentication tokens:

Terminal window
$ curl -s --netrc-file ~/.config/nix/netrc https://MY_CACHE.cachix.org/nix-cache-info

See Custom CA certificates.