Repository navigation
pnpmBuildHook: init and migrate some packages - #487046
Conversation
|
opencloud bits LGTM. |
There was a problem hiding this comment.
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
efdd262 to
4ed70ac
Compare
4ed70ac to
abf3aee
Compare
|
Rebased and updated.
|
|
The way bash works, |
|
Owner check timed out. Will close and reopen to kick it. |
|
|
OK, so |
| echo "Executing pnpmBuildHook" | ||
|
|
||
| if [[ $pnpmRoot ]]; then | ||
| pushd "$pnpmRoot" |
There was a problem hiding this comment.
Also, nitpick, this (and other pushd/popd invocations) should probably be &> /dev/null.
I believed that |
I did! Not in the last week but I did previously. |
| # 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; |
There was a problem hiding this comment.
I'd move the TODO comment to near __structuredAttrs ? false.
| pnpm | ||
| ] | ||
| ++ lib.optionals isLinux [ | ||
| pnpmBuildHook |
There was a problem hiding this comment.
I'm surprised this is Linux only... It replaces buildPhase commands that are not Linux only.
| }; | ||
|
|
||
| nativeBuildInputs = [ | ||
| pnpmConfigHook |
There was a problem hiding this comment.
Not adding pnpm itself? It is a requirement of both pnpm{Config,Build}Hook...
| let | ||
| pnpm = pnpm_10; | ||
| in |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
(cherry picked from commit 064da74)
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 callspnpm buildin Nixpkgs I am aware of.Once this is merged I plan on making a corresponding
pnpmInstallHookas 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
makeSetupHookso that it could be added toby-name. This is backward compatible since that attr would be rejected previously.passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.