Skip to content

npc: init at 1.0.0 - #543008

Merged
K900 merged 1 commit into
NixOS:masterfrom
me-and:npc
Aug 9, 2026
Merged

K900 merged 1 commit into
NixOS:masterfrom
me-and:npc

Conversation

@me-and

@me-and me-and commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

npc is an MIT-licensed tool for working with Nix channels and channel histories. In particular, it provides an npc bisect command that provides similar function to git bisect but only considering commits that have actually been pointed to by a relevant Nixpkgs release branch.

@samestep I've added you as a maintainer, since you're the author, but you obviously get to opt out!

Things done

@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (new) This PR adds a new package 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Jul 17, 2026

@samestep samestep left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@me-and it makes me so happy to see this, thank you! Unfortunately there's a blocker; see my comments below. Would love to hear your thoughts if you have a suggestion to unblock this!

Comment thread pkgs/by-name/np/npc/package.nix Outdated

env = {
NPC_REV = finalAttrs.src.rev;
GIT_BIN = lib.getExe git;

@samestep samestep Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is wrong; see samestep/npc#6. What do you think is the best solution here?

  1. Try sending another email on the Git mailing list to see if people respond this time?
  2. Add Jonathan Tan's one-line patch to the Git package definition in Nixpkgs, and target staging.
  3. Use that patch but only for the Git that gets fed to npc itself.
  4. Something else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spotted that; I'd assumed (perhaps naively) that the bug was at least rare, so it'd be fine to just live with it until it gets fixed in the Git source code.

That said, I rather expect submitting Jonathan Tan's one-line patch as a properly formatted patch to the Git mailing list would get it accepted. And once there's a patch on the mailing list, regardless of whether it's accepted or not, I think it'd be reasonable to add it to the Nixpkgs Git package.

@samestep samestep Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd assumed (perhaps naively) that the bug was at least rare, so it'd be fine to just live with it until it gets fixed in the Git source code.

It's been several months since I've tried running npd with Git 2.48+, but if I remember correctly, I was hitting the bug pretty consistently before I pinned the older Git version. If it's not too much to ask, would you be able to try it out on your end to see if you hit it?

That said, I rather expect submitting Jonathan Tan's one-line patch as a properly formatted patch to the Git mailing list would get it accepted.

Yeah I think you're right 😅 to be honest, I've had this on my TODO list for months now. Obviously the patch itself is super easy, but then I'd also have to include a regression test, and I just haven't gotten around to understanding the Git codebase's testing setup well enough to feel confident in writing and sending it...

@me-and me-and Jul 17, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I just ran the following and didn't hit the problem in any of the ten test clones

( set -xeuo pipefail; for (( n=0; n<10; n++ )); do d="$(mktemp -d)"; git clone --mirror --filter=tree:0 https://github.com/NixOS/nixpkgs.git "$d"; rm -rf "$d"; done )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the initial clone works fine; it's the git fetch that gives the error. Although, I did also recently change how the fetching works in samestep/npc@8d5e25b, so maybe it avoids the bug now somehow? I'd be surprised though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that was 50 runs without reproducing the bug with git v2.54.0! I'll test with v2.49 now, just to be sure it's not an environmental issue...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow! And I assume this is after the more recent change to how npc fetches? If you want, it may also be useful to try with an npc commit prior to that change.

I'll look into sending that patch on the Git mailing list later today.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'm not managing to reproduce the problem with git v2.49.0 either. Specifically, I've just run the following and didn't see any issues:

( set -euo pipefail; git () { /nix/store/lchj5sfm6yyhv5jhahh5xr2fg239218r-git-2.49.0/bin/git "$@"; }; d="$(mktemp -d)"; git clone --mirror --filter=tree:0 https://github.com/NixOS/nixpkgs.git "$d"; cd "$d"; for (( n=0; n<20; n++ )); do git fetch --no-show-forced-updates; done )

So I don't think we can conclude anything from my testing other than there's some environmental factor at play :(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for testing! I'll do some more testing on my end later today.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And as a slightly different datapoint: I just rebuilt a couple of my machines using npc from your flake, but with both nixpkgs and nixpkgs-git pinned to a recent nixpkgs-unstable. Twenty runs of npc fetch on two different systems and I didn't see anything untoward.

@nixpkgs-ci nixpkgs-ci Bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jul 17, 2026
@me-and

me-and commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 543008
Commit: 05c990188cc3ac8e1781e14fab5482a295e51a83


x86_64-linux

✅ 1 package built:
  • npc

aarch64-linux

✅ 1 package built:
  • npc

@me-and me-and changed the title npc: init at 0-unstable-2026-07-11 npc: init at 1.0.0 Jul 17, 2026

@samestep samestep left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp. I tried a bunch yesterday and today to reproduce the git fetch issue, and I couldn't 🙃

So I'd say ship it! Thanks again for opening this PR 😄

@samestep

Copy link
Copy Markdown
Contributor

Oh wait hang on I tried a bit more and I think I actually reproduced it this time; please hold...

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jul 18, 2026
@samestep

samestep commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

OK yep, turns out we're good 🥳

The bug was fixed by git/git@7a4bd1b, which was released in Git 2.53, so the Git 2.54 currently in Nixpkgs works great! I also did samestep/npc#44 upstream.

@samestep

samestep commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

npb · 38ced06 → a495202

Expand this for a reproducible command.
npb --base 38ced06161c11eb06ba8791240f06ce2a7221052 --head 59682e0069f0ed0a452e2179a7f4c1f247027b9e --patch 59682e0069f0ed0a452e2179a7f4c1f247027b9e...a4952026d240b18ffc5503c9b481aac861fbe35b -s x86_64-linux -s aarch64-linux -s aarch64-darwin
Expand this for a legend of all symbols below.
  • ✅ = successfully built
  • ❌ = failed to build
  • 🚫 = dependency failed to build
  • ⏩ = didn't try to build
  • ❔ = couldn't try to build
  • ➖ = doesn't exist

x86_64-linux

➖ → ✅ · 1 package
  • npc

aarch64-linux

➖ → ✅ · 1 package
  • npc

aarch64-darwin

➖ → ✅ · 1 package
  • npc

@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/3213

@K900
K900 added this pull request to the merge queue Aug 9, 2026
Merged via the queue into NixOS:master with commit 9462939 Aug 9, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants