Skip to content

Typically packages come prebuilt with binaries provided by the official binary cache.

If you're modifying a package or using a package that's not built upstream, Nix will build it from source instead of downloading a binary.

To prevent packages from being built more than once, there's seamless integration with binary caches using Cachix.


If you'd like to push binaries to your own cache, you'll need to create one.

After that you'll need to set cachix authtoken XXX with either a personal auth token or a cache token (that you can create in cache settings).


To specify pre-commit-hooks as a cache to pull from and mycache to pull from and push to:

  cachix.pull = [ "pre-commit-hooks" ];
  cachix.push = "mycache";

Pushing only in specific cases

You'll likely not want every user to push to the cache.

It's usually convenient to push explicitly, for example as part of CI run:

$ echo '{ cachix.push = "mycache"; }' > devenv.local.nix