Skip to content

fix(setup-nix): keep substituters from extra_nix_config - #60

Merged
hakula139 merged 3 commits into
mainfrom
fix/setup-nix-substituters
Nov 10, 2026
Merged

hakula139 merged 3 commits into
mainfrom
fix/setup-nix-substituters

Conversation

@hakula139

@hakula139 hakula139 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

setup-nix lost every substituter a caller added through extra_nix_config. install-nix-action writes those lines to /etc/nix/nix.conf, and cachix-action's cachix use hakula then writes a plain substituters = https://cache.nixos.org <plain substituters from the global conf> https://hakula.cachix.org to ~/.config/nix/nix.conf. cachix's parser keeps only plain substituters lines, so extra-substituters never makes it into that list, and because the runner user is trusted, the later user conf replaces the whole setting. In nixos-config's CI on Nix 2.34.9, nix config show went from cache.nixos.org cache.numtide.com to cache.nixos.org hakula.cachix.org.

cachix-action now runs with skipAddingSubstituter: true, and the install step adds the hakula cache itself as extra-substituters and extra-trusted-public-keys, ahead of fallback = true and the caller's lines. The key is the one the Cachix API publishes for hakula, which also matches the flake's nixConfig.

Pushing is unchanged. In cachix-action v17, skipAddingSubstituter only skips cachix use, while the push mode is chosen from the auth token and skipPush, and both the daemon (cachix daemon run hakula) and store-scan pushes talk to the Cachix API with the token, never consulting Nix's substituters. nix-cache.yml's own cachix push and cachix pin still find the cachix binary the action installs.

A caller whose extra_nix_config sets a plain substituters or trusted-public-keys now replaces the hakula entry, which cachix use used to re-add on trusted runners. That costs only cache misses, and the caller's explicit assignment winning is the expected contract.

Test plan

  • A temporary workflow ran setup-nix with extra_nix_config adding cache.numtide.com and its key, then nix config show | grep -E '^(extra-)?(substituters|trusted-public-keys)', on Linux and macOS:

    # setup-nix@v3
    substituters = https://cache.nixos.org https://hakula.cachix.org
    trusted-public-keys = cache.nixos.org-1:... hakula.cachix.org-1:...
    
    # This branch
    substituters = https://cache.nixos.org/ https://hakula.cachix.org https://cache.numtide.com
    trusted-public-keys = cache.nixos.org-1:... hakula.cachix.org-1:... niks3.numtide.com-1:...
    

    This branch also left no ~/.config/nix/nix.conf behind. The workflow is removed again.

  • GitHub CI: the Linux leg still substitutes from https://hakula.cachix.org, and cachix-action logs Not adding Cachix cache to substituters and skipPush is enabled

  • nix flake check --all-systems and nix develop -c run-hooks

  • Independent review

Pushing from the default branch is untested, since a PR run skips it, and rests on the cachix-action code path above.

@hakula139 hakula139 added the bug Unexpected behavior label Nov 10, 2026
@hakula139 hakula139 self-assigned this Nov 10, 2026
cachix-action's `cachix use` writes a plain `substituters` list to the
user's nix.conf. Its parser drops `extra-substituters`, and the trusted
runner applies the user conf last, so every substituter a caller added
through `extra_nix_config` was lost.

Skip `cachix use` and add the `hakula` cache through install-nix-action's
`extra_nix_config` instead. Pushing goes through the auth token and the
Cachix API, so it does not depend on the substituter.
@hakula139
hakula139 force-pushed the fix/setup-nix-substituters branch from 322252e to 7fa911d Compare November 10, 2026 08:50
@hakula139
hakula139 merged commit c65fe09 into main Nov 10, 2026
3 checks passed
@hakula139
hakula139 deleted the fix/setup-nix-substituters branch November 10, 2026 08:54
@hakula139 hakula139 mentioned this pull request Nov 10, 2026
7 tasks done
hakula139 added a commit that referenced this pull request Nov 10, 2026
## Summary

Prepare 3.1.0, a minor release for everything merged since 3.0.1. The
notes cover the reusable `python.yml`, `node.yml`, and `rust.yml`
workflows with Codecov over OIDC and the CI conventions in `docs/ci.md`
(#61, #73), `dk.writeNuApplication` (#63), the hooks the baseline now
enables by default (#54), the Ruff and uv floors that move the pinned
hooks from Ruff 0.15.14 to 0.17.3 and may reformat consumer code (#61),
the `github` helper's `--private` switch, extra required checks, and
ruleset template changes (#55, #65, #67), the release workflow's plugin
manifest check (#70), the Renovate preset's broader matching (#68), and
the fixes to the dev shell hook's stdout, the Nushell argument guard,
and `setup-nix` substituters (#74, #62, #60). The ignore-rule cleanup
(#58) and the contributor rule in `AGENTS.md` (#64) have no
consumer-visible effect, so the notes leave them out.

Every change keeps existing callers working, with two judgment calls
under [Choose the
version](https://github.com/hakula139/devkit/blob/main/docs/releasing.md#choose-the-version):

- `github ruleset --config` is removed (#67), which the policy would
class as major. No repository calls it, so it ships as minor, and the
entry names the removal.
- The plugin manifest check (#70) can fail a `release.yml` run. Of the
two callers, one has no `.claude-plugin/plugin.json`, and the other
reads its package version from that manifest, so neither run can fail.

The copy-ready `v3` references in `docs/` stay unchanged. The shared
header and earlier release sections are unchanged, with the new compare
reference inside its release section.

## Test plan

- [x] Drafted the section with `nix run .#changelog -- v3.1.0`, then
curated it against each PR's diff
- [x] Evaluated devkit's locked nixpkgs and `nixpkgs-unstable`: Ruff
0.15.14 → 0.17.3 and uv 0.11.21 → 0.13.5
- [x] Header and complete release history byte-preservation check
against `main`
- [x] `nix develop -c run-hooks`
- [x] Normal commit and push hooks
- [x] `nix flake check --all-systems`
- [x] GitHub CI: Linux, macOS, and CI Result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant