Pin the development and CI toolchain with a Nix flake #428
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#428
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The tool versions for development and for CI come from two unrelated sources, and
neither is pinned in this repository.
CI.
.github/Dockerfile.cibuilds the image from.github/deps/, which isgitignored. To rebuild the image a person follows a manual procedure in
.github/ci-image.md:33-45that runsdocker cpto take binaries out of anothercontainer by hand. The Dockerfile does not declare most versions — it globs
jdk-*andnode-v20.*, so the real versions live only in a markdown table.The workflow pulls
iw-cli-ci:lateston a self-hosted runner, so the image canchange with no commit here.
Development. Each machine supplies its own tools. Nothing ties a developer's
JDK, scala-cli, mill, node or bats to the versions CI uses.
The two sets agree today by luck, not by construction. Tool drift is found only
when CI turns red.
Proposal
Declare the toolchain once in a Nix flake, commit
flake.lock, and derive boththe developer shell and CI from it.
Tools to cover: JDK 21, scala-cli, coursier, scalafix, mill 1.1.5, Node 20 with
corepack, bats 1.12.0, tmux, jq, rsync, python3, git, gh, glab, fj.
CI route — decide during analysis, not now
Two routes are open. Choose one when the issue is analysed.
dockerTools.buildLayeredImage. The image becomes a derived artifact and thehand-assembly step disappears.
nix develop --command ./iw ./test. A self-hosted runner keeps a warm store,so there is no image to build and none to push.
Known constraints
libraries and Yarn 4 still resolves the Node packages (and still needs
WEBAWESOME_NPM_TOKEN). The result is one declared toolset, not a reproduciblebuild. Tool drift is the problem that actually occurred, so this still hits the
target.
fjis unlikely to be in nixpkgs, and mill 1.1.5and the pinned scala-cli version may not match the nixpkgs versions. These need
fetchurlderivations or an overlay../iwis the entry point for every command. Without direnv each call becomesnix develop -c ./iw …. An.envrcwithuse flakesolves this, but then eachdeveloper must install direnv. Decide this with the CI route.
Origin
Found while triaging LESSONS.md for IW-422. A captured lesson claimed
batswasabsent from the machine and had to be run through
nix-shell -p bats. By triagetime the claim was already false —
bats1.12.0 was in the user profile. Thelesson was deleted, because the real problem is not a missing binary but an
unpinned toolchain.
Intake: needs-input
1. Which route must CI use: an image built from the flake, or Nix on the self-hosted runner?
Each CI job runs in the container
iw-cli-ci:lateston a self-hosted runner (ci.yml#L30-L32). Route b changes the runner host, which is not in this repository, and nothing here tells whether that host has Nix. Open issue #407 (glab is missing from the CI image) is related, but it is a different issue.dockerTools.buildLayeredImage. The workflows stay almost the same. A person must still build and push the image after each change toflake.lock, unless CI also builds it.nix develop --command ./iw ./teston the runner. No image to build or push. The runner host must get a Nix store, and each job must be changed to run withoutcontainer:. If you choose b, paste the output ofnix --versionfrom the runner host, or write "no Nix".Recommended: a) — It changes only this repository, so the analysis does not depend on a host it cannot see.
2. Must the repository have an
.envrcwithuse flake, so that./iwworks withoutnix develop -c?Each developer command starts with
./iw. Without direnv, each call becomesnix develop -c ./iw …..envrcand document direnv as a development requirement. Commands stay the same. Each developer must install direnv and rundirenv allowone time..envrc. Documentnix developas the way to enter the shell. There is no new tool to install. Developers must open the shell before they start work.Recommended: a) — You keep the habit of typing
./iwdirectly, and the file costs nothing to a person who does not use direnv.Answer in a comment on this issue, per number, for example "1: a", or in your own words; intake reads it on its next iteration.