Skip to content

ci(nix): provision CI tooling via the flake dev-shell - #653

Merged
c-vigo merged 1 commit into
feature/625-nix-claude-migrationfrom
feature/632-ci-via-flake
Jun 23, 2026
Merged

c-vigo merged 1 commit into
feature/625-nix-claude-migrationfrom
feature/632-ci-via-flake

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

CI now provisions its build/test toolchain from the Nix flake (the toolchain SSoT, #631) via nix develop, proving the vig-os Cachix binary cache under real CI load before any image risk (T2.1/#634) is taken.

  • setup-env action gains a provision-via-flake mode: installs Nix (SHA-pinned cachix/install-nix-action, matching nix-cachix.yml) and the vig-os Cachix substituter, builds the flake dev-shell, and prepends its nix-store bin dirs to GITHUB_PATH so every subsequent step runs as if inside nix develop.
  • The ad-hoc installs of uv/Python, just, hadolint, taplo are gated off in this mode (they come from the flake).
  • podman, Node.js, BATS, and the devcontainer CLI keep their dedicated install steps — podman needs the runner's setuid newuidmap/newgidmap and host container config for rootless mode; BATS/devcontainer-CLI are not in the flake.
  • Mode enabled across the CI build/test path: build-image, test-image, test-integration, project-checks. The cache name (vars.CACHIX_CACHE) and token (secrets.CACHIX_AUTH_TOKEN) are threaded from ci.yml through each action into setup-env.

Out of scope (unchanged)

Verification

Local (host Nix 2.34.7):

  • nix flake metadata resolves the flake.
  • nix develop ... --command builds the dev-shell and reports the gated tools: uv 0.11.19, just 1.40.0, hadolint 2.12.0, taplo 0.9.3, node v22.20.0, jq 1.7.1, gh 2.94.0.
  • Reproduced the action's PATH-extraction logic: it isolates the 46 /nix/store/*/bin dirs from the dev-shell $PATH (just/uv/hadolint/taplo/node/git/gh all present) — exactly what gets appended to GITHUB_PATH.
  • just precommit green (ruff, yamllint, taplo, shellcheck, hadolint, pymarkdown, check-action-pins, sync-manifest, agent-identity, branch-name).

Full CI build-time cold-vs-warm Cachix comparison (issue test note) will come from this PR's own CI run.

Refs: #632

Add a provision-via-flake mode to the setup-env action that installs
Nix (SHA-pinned) plus the vig-os Cachix substituter, builds the flake
dev-shell, and prepends its tools to PATH so subsequent steps run inside
the shell. The ad-hoc installs of uv/Python, just, hadolint, and taplo
are gated off in this mode; podman, Node.js, BATS, and the devcontainer
CLI keep their dedicated paths. Enable the mode across the CI build/test
path (build-image, test-image, test-integration, project-checks). The
Debian image is still built unchanged and the Docker type=gha cache stays
intact.

Refs: #632
@c-vigo
c-vigo marked this pull request as ready for review June 23, 2026 11:51
@c-vigo
c-vigo merged commit f0634cb into feature/625-nix-claude-migration Jun 23, 2026
12 of 18 checks passed
@c-vigo
c-vigo deleted the feature/632-ci-via-flake branch June 23, 2026 11:51
c-vigo added a commit that referenced this pull request Jun 23, 2026
## Summary

Follow-up fix for #632 (T1.2). PR #653 enabled flake-provisioned CI but
its `Build Container Image` and `Project Checks` jobs failed. PR #653
was already squash-merged into the epic at the broken state, so this
lands as a new PR against `feature/625-nix-claude-migration`.

Three coordinated fixes, one root chain:

### 1. uv could not provide CPython 3.14.6

`uv sync --frozen --all-extras` failed with `No interpreter found for
Python 3.14.6`. Causes:

- The project pins an **exact** patch (`requires-python == 3.14.6`, also
in `uv.lock`). nixpkgs does not package it — `nixos-25.05` has
`python314 == 3.14.0`, `nixpkgs-unstable` has `3.14.4`; a Nix
interpreter is rejected by `uv --frozen` as incompatible.
- The **nixpkgs build of `uv`** ships with its embedded Python-download
list stripped, so it cannot fetch a managed CPython on its own.

**Fix:** set `UV_PYTHON_DOWNLOADS_JSON_URL` in the flake dev-shell
(`mkProjectShell` in `flake.nix`, the toolchain SSoT) to upstream uv's
`download-metadata.json`, pinned to the same uv release the non-flake CI
path installs (`0.11.23`). This restores managed downloads without
un-pinning nixpkgs. `UV_PYTHON_DOWNLOADS` keeps its default.

### 2. The variable did not reach CI steps

`GITHUB_PATH` only carries PATH, not env vars, so the dev-shell variable
never reached the `uv sync` step. **Fix:** forward
`UV_PYTHON_DOWNLOADS_JSON_URL` from the dev-shell to `GITHUB_ENV` in the
`provision-via-flake` setup step.

### 3. The flake's podman shadowed the host podman

With (1)+(2) fixed, build/image/integration jobs went green but `Project
Checks` still failed: a BATS dry-run test (`tests/bats/install.bats`)
errored because `install.sh` runs `podman info` and the flake's
nix-store podman cannot reach the runner's setuid
`newuidmap`/`newgidmap`. **Fix:** exclude the flake podman bin from the
`provision-via-flake` PATH export so the runner's rootless-configured
host podman is used (matches the documented intent on the
`provision-via-flake` input). The flake's `devTools` (and the parity
test) are unchanged.

### Validation

- `nix develop -c uv sync --frozen --all-extras` succeeds; dev-shell and
venv both report **Python 3.14.6**.
- `pre-commit run --all-files` green; flake parity test passes; `nix
flake check` passes.
- Full CI on this branch is **green**: Build Container Image, Project
Checks, Image Tests, Integration Tests, Security Scan, Python Security
Scan, Test Summary.

Refs: #632
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