Skip to content

fix(workflows): trust the consumer flake's nixConfig in devkit-upgrade - #1600

Merged
c-vigo merged 2 commits into
devfrom
bugfix/1599-upgrade-nix-accept-flake-config
Sep 2, 2026
Merged

c-vigo merged 2 commits into
devfrom
bugfix/1599-upgrade-nix-accept-flake-config

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Description

The scaffolded devkit-upgrade.yml installed Nix with only
experimental-features, so a consumer repo whose flake.nix declares a
nixConfig block had it ignored on both Nix legs of the job — install.sh's
nix flake update vigos and the nix develop -c git commit — each emitting

warning: ignoring untrusted flake configuration setting 'extra-substituters'.
Pass '--accept-flake-config' to trust it

and resolving the dev-shell against cache.nixos.org alone.

setup-devkit-toolchain — same scaffold payload, same runner class, same
consumer flake — has always passed the full set. This closes the gap and pins
all three copies to one constant.

Type of Change

  • fix -- Bug fix

Modifiers

  • Breaking change (!)

Changes Made

  • assets/workspace/.github/workflows/devkit-upgrade.yml — the Install Nix
    step now carries accept-flake-config = true, extra-substituters and
    extra-trusted-public-keys alongside experimental-features, with a comment
    explaining the [SECURITY] Harden baked nix.conf: drop accept-flake-config=true for explicit substituters + trusted-public-keys #773 boundary
  • tests/workflow_scaffold.py — new shared NIX_SETTINGS constant and
    parse_nix_settings() helper, so the three places that ship these settings
    assert against one expectation instead of three
  • tests/test_workflow_devkit_upgrade.py — new
    test_install_nix_carries_the_toolchain_nix_settings
  • tests/test_setup_toolchain_env.py — its two existing assertions now use the
    shared constant (net −22 lines of hand-rolled parsing)

Not a #773 regression

#773 removed accept-flake-config = true from the image's baked
/etc/nix/nix.conf, where any in-container nix run github:attacker/flake would
silently trust a foreign flake's substituters.
tests/test_image.py::test_nix_conf_does_not_accept_flake_config still guards
that and is untouched.

This is the other case: a per-runner installer setting, in a job that evaluates
the consumer's own repo flake and nothing else — the identical posture
setup-devkit-toolchain already ships to every consumer.

Scope note

This removes two warnings per run and restores the substituters the consumer's
flake asked for. It is not a meaningful speed-up: the upgrade step advances
the consumer's nixpkgs pin immediately before the nix develop, so that
closure is new and no cache holds it. Sized effort:small / priority:low
accordingly.

Changelog Entry

### Fixed

- **The scaffolded upgrade workflow now trusts your flake's own `nixConfig`**
  ([#1599](https://github.com/vig-os/devkit/issues/1599))
  - `devkit-upgrade.yml` installed Nix with only `experimental-features`, so a
    repo whose `flake.nix` declares `nixConfig.extra-substituters` had them
    ignored on both Nix legs of the job — `install.sh`'s `nix flake update` and
    the `nix develop` commit — each printing a `warning: ignoring untrusted
    flake configuration setting` pair and resolving the dev-shell against
    `cache.nixos.org` alone
  - The installer step now carries the same four settings
    `setup-devkit-toolchain` has always passed (`accept-flake-config` plus the
    vig-os Cachix substituter and its public key), so the two Nix entry points
    a consumer repo has behave identically
  - Unchanged: the image's baked `nix.conf` still does not set
    `accept-flake-config`. That
    ([#773](https://github.com/vig-os/devkit/issues/773)) was about trusting a
    *foreign* flake run inside the container; this is a per-runner setting in a
    job that evaluates the consumer's own repo flake and nothing else
  - Consumers pick this up on their next adoption PR; no repo-side edit is
    needed

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

TDD, both phases run:

  • RED (312f43af): 1 failed, 42 passed — the new assertion reported
    Right contains 3 more items: accept-flake-config, extra-substituters, extra-trusted-public-keys
  • GREEN (02c1a3db): 70 passed across
    test_workflow_devkit_upgrade.py + test_setup_toolchain_env.py
  • Full suite: 1570 passed, 3 skipped (pytest -q --deselect tests/test_image.py)
  • just precommit (prek run --all-files): all hooks green, including
    actionlint and yamllint on the edited workflow

Two local failures are pre-existing and environmental, both reproduced with
this branch's working-tree changes stashed, and
test_image.py::TestFileStructure::test_manifest_files also reproduced on a
clean origin/dev worktree:

  • test_image.py::TestFileStructure::test_manifest_files — the local
    ghcr.io/vig-os/devcontainer:dev image carries the pre-8e7c4916
    .pymarkdown (959f081e… vs the tree's 0ba0738d…); the image predates that
    2026-08-31 commit
  • test_integration.py::TestDevContainerCLI::test_github_cli_authentication —
    dbus-launch missing in the container, gh refusing a multi-account config
    migration

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly — no doc surface changes
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Consumers pick this up on their next devkit-upgrade adoption PR — the workflow
is devkit-managed, so a consumer-side edit would be overwritten anyway.

Refs: #1599

The scaffolded devkit-upgrade.yml installs Nix with only
experimental-features, so a consumer flake's own nixConfig substituters are
ignored on both Nix legs of the job. setup-devkit-toolchain — same payload,
same runner class, same flake — passes the full set.

Lift that expectation into workflow_scaffold as one NIX_SETTINGS constant
plus a parse_nix_settings helper, point the two existing toolchain
assertions at it, and add the failing third assertion for the upgrade
workflow's installer step.

Refs: #1599
Install Nix with the same four settings setup-devkit-toolchain has always
passed: accept-flake-config plus the vig-os Cachix substituter and its
public key. Both Nix legs of the job — install.sh's `nix flake update
vigos` and the `nix develop` commit — stop warning "ignoring untrusted
flake configuration setting" and can substitute from the caches the
consumer's own flake.nix declares.

Not a #773 regression: that removed accept-flake-config from the image's
baked nix.conf, where a container-run FOREIGN flake could redirect the
substituters. This is per-runner, in a job that evaluates the consumer's
own repo flake and nothing else.

Refs: #1599
@c-vigo
c-vigo merged commit d86d6f3 into dev Sep 2, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/1599-upgrade-nix-accept-flake-config branch September 2, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant