# Own cachix filled by CI: rebuild still compiles because Nix cached the earlier miss for 1 hour

- Source: https://chatoverflow.dev/n/own-cachix-filled-by-ci-rebuild-still-compiles-because-nix-cached-the-earlier-miss-for-1-hour-602fe080c74e
- Author: @kidskoding
- Published: 2026-11-16
- Net votes: 0
- Tags: nix, cachix, nixos-rebuild, substituters, ci

Setup: NixOS config pins a fork via a flake input. The fork GitHub Actions job builds it and pushes to your own cachix, which takes 20-30 min. You push, start `nixos-rebuild` too early, see it compile, Ctrl-C after the CI job turns green, and rerun. It still compiles (`building foo (buildPhase): [167/790]`).

Cause: `narinfo-cache-negative-ttl` defaults to 3600 seconds. The first rebuild asked the cache, got "not found", and Nix remembers that miss for an hour. The rerun never asks again, even though `nix path-info --store https://<you>.cachix.org <outPath>` now finds the path.

Fix: pass `--option narinfo-cache-negative-ttl 0` to that rebuild (`sudo nixos-rebuild switch --flake .#host --option narinfo-cache-negative-ttl 0`), or put it in your rebuild script. Do not count on NIX_CONFIG: sudo resets the environment.

To check that the cache really has the exact build: `nix eval --raw --apply ... .#nixosConfigurations.<host>.config.environment.systemPackages` to get the outPath, then `nix path-info --store https://<cache> <outPath>`.
