Skip to content

Add a repeatable --overlay CLI argument - #5

Merged
samestep merged 2 commits into
mainfrom
overlay
Oct 10, 2026
Merged

samestep merged 2 commits into
mainfrom
overlay

Conversation

@samestep

@samestep samestep commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Resolves #4.

`--overlay <EXPR>` (repeatable) appends a Nix expression to the nixpkgs
`overlays` argument on both sides of the comparison (#4). npb never parses
it: the config and overlays together are one `config = …; overlays = …;`
string spliced into the eval expression, and the eval key is now
`<sha256 of that string>/<system>`. That is sound because every evaluator
call now runs with `pure-eval = true`, so the string, tree and system are
all an eval can depend on. The repro command echoes each overlay as a
shell-quoted word.

Pure mode also fixes an existing leak: npb never passed `overlays`, so
nixpkgs applied any found in `~/.config/nixpkgs/overlays` or
`<nixpkgs-overlays>` under a key that didn't account for them. It replaces
`scrub_env`, which only covered `$SHELL`. Since pure mode won't read
npb's temp expression file directly, nix-eval-jobs now imports it through
a `fetchurl` locked to its SHA-256.

Across a full eval of x86_64-linux, aarch64-linux and aarch64-darwin, the
only drv that changes is `tests.fetchPypiLegacy.fetchSimple` (it branches
on `inPureEvalMode`). The old three-character profile directories are never
read again and age out under `--clean`, so no eval-cache format bump.

The README section and `--help` text for `--overlay` are placeholders, since
neither may contain AI-generated text.

Assisted-by: Claude:opus-5.5
@samestep

samestep commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

@me-and could you try this out and let me know if it works for your use case? I stopped short of adding a fully general evaluation config string argument because there were a couple tricky bits there, although I believe we could definitely add it later. And then the other deviation here is that, since we do still construct such a string internally, we just hash that string instead of normalizing it in some way (which would have had its own issues).

@me-and

me-and commented Oct 8, 2026

Copy link
Copy Markdown

I'm having a play now; it might take a few days before I can do some comprehensive testing.

@me-and

me-and commented Oct 8, 2026

Copy link
Copy Markdown

Although I've just done a relatively minimal test and, checking the build logs, it appears to be doing exactly what I'm after!

npb · 847c87de24b991b6dacf9eb8fe8c2cd0b89d4c96 → 847c87de24b991b6dacf9eb8fe8c2cd0b89d4c96*

Expand this for a reproducible command.
npb --base 847c87de24b991b6dacf9eb8fe8c2cd0b89d4c96 --head 847c87de24b991b6dacf9eb8fe8c2cd0b89d4c96 --patch /dev/stdin --overlay 'final: prev: { gitMinimal = prev.gitMinimal.override { doInstallCheck = false; }; git = prev.git.override { doInstallCheck = false; }; gitSVN = prev.git.override { doInstallCheck = false; }; gitFull = prev.gitFull.override { doInstallCheck = false; }; }' --no-tests -p gitMinimal -s x86_64-linux <<'PATCH'
diff --git a/pkgs/by-name/gi/git/package.nix b/pkgs/by-name/gi/git/package.nix
index 9c656cbfa85a..ff171f19aecc 100644
--- a/pkgs/by-name/gi/git/package.nix
+++ b/pkgs/by-name/gi/git/package.nix
@@ -56,7 +56,7 @@
   cargo,
   rustc,
   nix-update-script,
-  withBreakingChanges ? false,
+  withBreakingChanges ? true,
 }:

 assert osxkeychainSupport -> stdenv.hostPlatform.isDarwin;
PATCH
Expand this for a legend of all symbols below.
  • ✅ = successfully built
  • ❌ = failed to build
  • 🚫 = dependency failed to build
  • ❔ = couldn't try to build
  • ⏩ = failed to evaluate
  • ➖ = doesn't exist

x86_64-linux

✅ → ✅ · 1 package
  • gitMinimal

@me-and

me-and commented Oct 8, 2026

Copy link
Copy Markdown

...and having spotted the error in my previous command (gitSVN = prev.git.override... rather than gitSVN = prev.gitSVN.override...), rebuilding with that corrected had npb repeat the "resolve" stage but then immediately produce the same results since the underlying derivations weren't changed by that fix.

Looking in the ~/.cache/nix-npb/ directory, I can see the second run added a second cache directory.

So that's all exactly what I'd expect in this scenario 🎉

@samestep

samestep commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

Amazing! :) Hopefully I'll have some time in the next couple days to get this PR ready to merge and then make a v1.2.0 release.

@samestep
samestep marked this pull request as ready for review October 10, 2026 20:39
@samestep
samestep merged commit c4339fa into main Oct 10, 2026
1 check passed
@samestep
samestep deleted the overlay branch October 10, 2026 20:44
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.

Feature request: pre-change patches or overlays

2 participants