Repository navigation
fix(cachix): fetch public signing keys for pull caches again - #3178
Merged
Merged
Conversation
Since the 2.0 rewrite the keys were only read from cachix_trusted_keys.json and nothing wrote that file, so extra-trusted-public-keys was always empty and Nix could not verify paths from any cachix.pull cache whose key was not already in nix.conf. Fetch the missing keys from the Cachix API in CachixIntegration::init (bearer auth with the resolved token, so private caches work), cache them in cachix_trusted_keys.json, and warn per cache instead of failing when one does not exist or needs a token. Fixes cachix#3176 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
🔍 Suggested ReviewersBased on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:
Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏 This comment was automatically generated by git-blame-auto-reviewer Last updated: 2026-09-10T10:01:46.088Z |
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happened
While tracing why
cachix.pullhad no effect on our multi-user Macs (#3175), we checked what devenv would hand the daemon once the substituters did get through, and found the key list is always empty.CachixIntegration::initonly readsknown_keysfrom$XDG_DATA_HOME/devenv/cachix_trusted_keys.json, and nothing in 2.x writes that file: on a machine that has only ever run 2.x,~/.local/share/devenv/contains justgc/.CacheMetadata(publicSigningKeys) indevenv-corehas no consumer and there is no request to the Cachix API anywhere in the repo. Up to v1.11,devenv/src/nix.rsfetchedhttps://cachix.org/api/v1/cache/<name>, stored the keys in that file and passed them as--option extra-trusted-public-keys; the fetch was lost in the 2.0 rewrite. Issue: #3176.Who else hits this
Everyone on 2.x, for every
cachix.pullcache whose key is not already innix.conf. Nix refuses paths signed by an unknown key (ignoring substitute for '...' as it's not signed by any of the keys in 'trusted-public-keys') and builds them instead. On multi-user installs this is currently masked by #3175, and becomes the blocker as soon as that is fixed. On single-user installs, whose in-process Worker does use the runtime substituter list, the missing key is already the reason paths from acachix.pullcache get built today.Change
Restore the fetch in
CachixIntegration::init, mirroring 1.x: for each pull cache missing from the cached map, GEThttps://cachix.org/api/v1/cache/<name>with the resolved auth token as bearer (so private caches work), merge and persist tocachix_trusted_keys.json, then build the store settings as before. A cache that does not exist or needs a token is reported as a warning in the "Configuring cachix" activity and skipped, so one bad cache does not cost the others their keys. Fetches run concurrently with a 15s timeout.Adds
reqwestto thedevenvcrate (already a workspace dependency);Cargo.lockandCargo.nixregenerated.Test plan
cargo fmt --check,cargo check -p devenv,cargo build -p devenvin the dev shell (aarch64-darwin).cargo clippyreports only a pre-existing lint indevenv-core/src/cachix.rs, untouched here.DEVENV_HOME:devenv eval cachix.pullin a project with the default pull list producedcachix_trusted_keys.jsoncontaining"devenv": "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=".tests/cachix-public-keysasserts the same from a freshDEVENV_HOME.Fixes #3176.
🤖 Generated with Claude Code