Repository navigation
fix: let the upgrade preflight pass untracked output the upgrade will ignore - #1839
Merged
Merged
Conversation
This was referenced Oct 5, 2026
gerchowl
force-pushed
the
feature/1831-rust-pack-adopter-docs
branch
from
October 5, 2026 19:32
85398ce to
b2fb0ab
Compare
gerchowl
force-pushed
the
bugfix/1826-preflight-untracked-build-output
branch
from
October 5, 2026 19:36
fd9b513 to
3aabb08
Compare
Contributor
Author
|
Follow-ups from an independent review:
Stack tip verified locally: |
gerchowl
force-pushed
the
feature/1831-rust-pack-adopter-docs
branch
from
October 5, 2026 19:41
b2fb0ab to
9683956
Compare
gerchowl
force-pushed
the
bugfix/1826-preflight-untracked-build-output
branch
2 times, most recently
from
October 5, 2026 20:43
f23c976 to
388cadb
Compare
gerchowl
added a commit
that referenced
this pull request
Oct 5, 2026
## Description A flake that consumes a devkit project's `packages` (e.g. one binary from a Rust CLI built by `mkRustProject`) inherits devkit's whole input tree in its lock: home-manager twice, git-hooks, treefmt, process-compose, services-flake and a second nixpkgs. This PR documents, and puts under test, how the **consuming** flake avoids that. **Stack 6/6** for #1833. Base: #1839 (`bugfix/1826-preflight-untracked-build-output`). ## Type of Change - [x] `docs` -- Documentation only - [x] `test` -- Adding or updating tests ## Changes Made The issue offered two remedies. I measured before choosing: | downstream flake | lock nodes | package store path | | --- | --- | --- | | plain `my-tool.url` | 17 | `…b87d0…-consumer_matrix_rust-0.1.0` | | + `nixpkgs` follows (the issue's dedupe stanza) | 17 (nixpkgs is now the consumer's) | same | | + `follows = ""` on the 7 devkit inputs packages never read | **8** | **same** | - **Docs (taken):** new `docs/MIGRATION.md` section "Projects that ship packages to other flakes", with the full consumer stanza: build with the consumer's nixpkgs, and empty the seven unused devkit inputs with Nix's `follows = ""` idiom. That leaves `nixpkgs`, `crane`, `fenix` and `flake-utils`. The two stub flakes (`assets/workspace/flake.nix`, `assets/flake.d/rust.flake.nix`) get a comment pointing there. - **Template flip (not taken):** making `vigos` follow the project's `nixpkgs` would re-pin devkit's tools, overlay and dev shell onto a nixpkgs devkit never tested or cached. The issue's own caveat says this needs a guard. Since the consumer-side stanza fully solves the reported problem, the flip isn't needed. The rationale is in the doc section. - **Contract test** `tests/test_flake_package_consumers.py`: - It executes the documented block **verbatim** from MIGRATION.md, only swapping in local URLs, against a project rendered from the `#rust` template plus the seeded `mkRustProject` flake, with `vigos` overridden to this checkout. It must build. - A second test asserts that the stanza's drop list equals devkit's inputs minus the four a package needs. A new devkit input therefore fails CI until the doc covers it. ## Changelog Entry ### Changed - **Documented, tested stanza for flakes that consume a devkit project's packages** ([#1832](#1832)) - New `docs/MIGRATION.md` section "Projects that ship packages to other flakes": the consuming flake builds the package with its own nixpkgs and drops the devkit inputs a package build never reads (`follows = ""`), so its lock shrinks from devkit's whole input tree to `nixpkgs`, `crane`, `fenix` and `flake-utils` - CI builds a Rust project's package through that exact block, and fails if devkit adds an input the stanza does not cover or starts reading one it drops. The scaffolded `flake.nix` keeps following devkit's nixpkgs, and points at the section ## Testing - [x] Both tests failed first (no documented stanza), then passed. - [x] Negative control: temporarily adding `crane.follows = ""` to the doc block makes the build test fail with `attribute 'mkLib' missing`. The test catches a real dependency, not just an evaluation. - [x] `tests/test_rust_scaffold.py` (the managed-block lockstep across both stubs) still passes. ## Checklist - [x] I have performed a self-review of my code - [x] I have updated the documentation accordingly - [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and pasted the entry above) - [x] I have added tests that prove my fix is effective or that my feature works Refs: #1832, #1833
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.
Description
The
install.sh --forcepreflight refused any untracked file. A repo that had just gained a language, such as a Rust repo withcargo buildoutput intarget/, therefore could not take the very upgrade that adds the.gitignorefragment ignoring it. The workaround was to move the build directory aside. Same fornode_modules/,.venv/and Nixresultlinks.Stack 5/6 for #1833. Base: #1838 (
feature/1831-rust-pack-adopter-docs).Type of Change
fix-- Bug fixtest-- Adding or updating testsChanges Made
The judgement moves to where the knowledge is. The host doesn't know the gitignore fragments or the detected languages; the image does.
install.sh(host): tracked changes still refuse, unchanged. Untracked paths (git ls-files --others --exclude-standard --directory) are no longer refused host-side. They are forwarded to the container asDEVKIT_PREFLIGHT_UNTRACKED. New--allow-untrackedflag skips that check: it names the paths it leaves out, and tracked changes still refuse.assets/init-workspace.sh(container):preflight_untracked_guardruns right after language detection, before any file is written. It assembles the root.gitignorethis run will write (template base + the detected languages'gitignore.dfragments +.gitignore.project, the same partsrender_gitignoreuses) and matches each path with git's own matcher (check-ignore --no-index) in a scratch repo, because the workspace's.gitmay be an unmounted worktree pointer. Covered paths are named and left in place. Any other path refuses by name and hints--allow-untracked/--skip-preflight.node_modules/without apackage.json), because its fragment won't be in the upgraded.gitignore.docs/MIGRATION.md"Upgrade preflight guard and preview" documents the rule and the flag.Changelog Entry
Fixed
install.sh --forcepreflight refused any untracked file, so a repo that had just gained a language (a Rust repo withtarget/) could not take the very upgrade that adds its.gitignorefragment. Untracked paths are now matched against the.gitignorethe upgrade will write; covered ones are named and left in place, any other one still refuses, by name--allow-untrackedflag runs the upgrade with untracked files present; tracked changes still refuseTesting
install.bats(5 new, 1 rewritten): untracked paths are forwarded rather than refused; a tracked change still refuses alongsidetarget/;--allow-untrackedproceeds and forwards nothing;--allow-untrackeddoesn't excuse a tracked change; a clean tree forwards nothing. All 30preflighttests pass.init-workspace.bats(4 new): a Rust repo'starget/passes while an untrackedCargo.tomlis named; an uncovered path refuses before.vig-osorjustfileexist;node_modules/withoutpackage.jsonrefuses;.gitignore.projectentries count as covered.Cargo.toml+cargo build, theninstall.sh --force) is the first init-workspace test.Checklist
CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Refs: #1826, #1833