Skip to content

pnpmBuildHook: init and migrate some packages - #487046

Merged
gepbird merged 7 commits into
NixOS:masterfrom
RossSmyth:pnpmBuildHook
Jun 3, 2026
Merged

gepbird merged 7 commits into
NixOS:masterfrom
RossSmyth:pnpmBuildHook

Conversation

@RossSmyth

@RossSmyth RossSmyth commented Feb 4, 2026 •

Copy link
Copy Markdown
Contributor

Things done

re: #317927

This adds the pnpm build hook. This allows one to use structured attributes and a unified interface for building pnpm packages. This does not use a builder. If this is desired a builder can be created later.

I migrated a few packages to this new hook. It's mostly a straight-forward process. The most complicated was umami, which also seems to be the most complex one that calls pnpm build in Nixpkgs I am aware of.

Once this is merged I plan on making a corresponding pnpmInstallHook as well. That hook is actually where the real meat and potatoes will lie, this is just an initial one to get cooking.

Needed a simple fix for makeSetupHook so that it could be added to by-name. This is backward compatible since that attr would be rejected previously.

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@nixpkgs-ci nixpkgs-ci Bot added 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. labels Feb 4, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested a review from GetPsyched February 4, 2026 22:07
@nixpkgs-ci nixpkgs-ci Bot added the 8.has: documentation This PR adds or changes documentation label Feb 4, 2026
@K900

K900 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

opencloud bits LGTM.

@diogotcorreia diogotcorreia left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I haven't looked at the other packages and the hook yet, only umami changes.

PS: nitpick, but the word after the : in the commit messages should be lowercase imo (e.g., umami: migrate to pnpmBuidHook)

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 487046 --additional-package umami.tests
Commit: efdd262cbd0a308d9dadd3a0c10685516acea336


x86_64-linux

✅ 6 packages built:
  • nixpkgs-manual
  • ocis
  • pnpmBuildHook
  • siyuan
  • umami
  • umami.tests.umami

Comment thread pkgs/by-name/um/umami/package.nix Resolved
Comment thread pkgs/by-name/um/umami/package.nix Resolved
Comment thread doc/hooks/pnpm.section.md Resolved
@jopejoe1
jopejoe1 requested a review from a team February 19, 2026 10:04
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 27, 2026
Comment thread doc/hooks/pnpm.section.md Resolved
@RossSmyth

Copy link
Copy Markdown
Contributor Author

Rebased and updated.

  1. Added pnpmRoot variable
  2. Added pnpmWorkspaces variable

@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label May 13, 2026
@RossSmyth
RossSmyth requested a review from diogotcorreia May 13, 2026 22:26
@RossSmyth
RossSmyth changed the base branch from master to staging May 13, 2026 22:29
@nixpkgs-ci nixpkgs-ci Bot closed this May 13, 2026
@RossSmyth

Copy link
Copy Markdown
Contributor Author

The way bash works, set -u cannot just be set magically. So I see no reason to fix issues of something that doesn't happen.

@RossSmyth

Copy link
Copy Markdown
Contributor Author

Owner check timed out. Will close and reopen to kick it.

@RossSmyth RossSmyth closed this Jun 2, 2026
@RossSmyth RossSmyth reopened this Jun 2, 2026
@gepbird

gepbird commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 487046
Commit: 3b8d94ca86e587df7cfaee83930e22251a06fb28


x86_64-linux

✅ 5 packages built:
  • nixpkgs-manual
  • ocis
  • pnpmBuildHook
  • siyuan
  • umami

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 2, 2026
@gepbird
gepbird added this pull request to the merge queue Jun 3, 2026
Merged via the queue into NixOS:master with commit e75fb5a Jun 3, 2026
73 of 75 checks passed
@K900

K900 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

OK, so opencloud.idp-web just does not build now. Was this ever actually tested?

echo "Executing pnpmBuildHook"

if [[ $pnpmRoot ]]; then
pushd "$pnpmRoot"

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.

Also, nitpick, this (and other pushd/popd invocations) should probably be &> /dev/null.

pull Bot pushed a commit to jpas/nixpkgs that referenced this pull request Jun 3, 2026
pull Bot pushed a commit to jpas/nixpkgs that referenced this pull request Jun 3, 2026
@gepbird

gepbird commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

OK, so opencloud.idp-web just does not build now. Was this ever actually tested?

I believed that nixpkgs-review built everything that has changed. I think making it a top level package (or a dependency of a top-level package) would make it visible for these automated checks. If that's not preferred, I'll put it in pnpm tests.

MiniHarinn pushed a commit to MiniHarinn/nixpkgs that referenced this pull request Jun 3, 2026
@RossSmyth

Copy link
Copy Markdown
Contributor Author

Was this ever actually tested?

I did! Not in the last week but I did previously.

@RossSmyth
RossSmyth deleted the pnpmBuildHook branch June 3, 2026 14:11
hatch01 pushed a commit to hatch01/nixpkgs that referenced this pull request Jun 3, 2026
@gepbird gepbird mentioned this pull request Jun 3, 2026
2 of 14 tasks
Comment on lines 736 to +739
# TODO(@Artturin:) substitutions should be inside the env attrset
# but users are likely passing non-substitution arguments through substitutions
# turn off __structuredAttrs to unbreak substituteAll
__structuredAttrs = false;
inherit __structuredAttrs;

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 move the TODO comment to near __structuredAttrs ? false.

pnpm
]
++ lib.optionals isLinux [
pnpmBuildHook

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'm surprised this is Linux only... It replaces buildPhase commands that are not Linux only.

Comment thread doc/hooks/pnpm.section.md
};

nativeBuildInputs = [
pnpmConfigHook

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.

Not adding pnpm itself? It is a requirement of both pnpm{Config,Build}Hook...

Comment thread doc/hooks/pnpm.section.md
Comment on lines +107 to +109
let
pnpm = pnpm_10;
in

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 personally don't like this pattern. What is this supposed to suggest? That packages always work with only a single pnpm version? This is not totally correct, and is confusing IMO. I think that some packages might indeed work only with a specific pnpm version, but that should be explained particularly for every package that has that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The issue is that pnpm's lockfile format changes very regularly, and each major version can only read a certain subset of lockfile formats, so packages that work with more than one version are the exception rather than the norm. It sucks, but that's the way it is with this package manager, so pinning explicitly is much better maintainance-wise, since otherwise on many releases we'd have to pin packages anyways.

@Scrumplex Scrumplex Jun 6, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The primary issue here is breaking changes in pnpm's store format. For example pnpm 10 replaced the old json based index with an sqlite database, meaning that fetchPnpmDeps output will be different when swapping from pnpm_9 to pnpm_10.

We can only do so much during our fixup phase sadly

@eclairevoyant eclairevoyant added backport release-26.05 Backport PR automatically and removed backport release-26.05 Backport PR automatically labels Jun 16, 2026
deadbaed pushed a commit to deadbaed/nixpkgs that referenced this pull request Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages 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.

9 participants