Repository navigation
fix(nix): use the cached nixpkgs pnpm build - #1878
Conversation
|
This run was cancelled 🛑 The workflow was cancelled before completion. Please check the link below for details. |
The release npm job spent ~27 minutes in `nix profile install` because the 12.8.1 override forced pnpm to be compiled from source on the 4-core GitHub-hosted arm runner. The Nix store cache did not help: pnpm-nixpkgs tracks unstable, so the derivation changed between releases and every release hit a cold build. The locked pnpm-nixpkgs now ships pnpm_12 12.9.0, which already supports autoDedupe, so drop the override and use nixpkgs' build as is. It substitutes from cache.nixos.org on every CI platform. With the build gone, restore the npm job's 10-minute timeout.
|
@coderabbitai review |
7c3eabb to
dad3a9d
Compare
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 2
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@ryoppippi I have started the AI code review. It will take a few minutes to complete. |
Keep the extra headroom on the publish job instead of tightening it to 10 minutes. Only the comment tying the timeout to a from-source pnpm build stays removed, since pnpm now substitutes from cache.nixos.org.
|
@coderabbitai review |
@ryoppippi I have started the AI code review. It will take a few minutes to complete. |
Keep the comment in nix/pnpm.nix to the two facts a reader needs at the definition: the package must stay unmodified so it substitutes from cache.nixos.org, and autoDedupe in pnpm-workspace.yaml needs pnpm 12.8.1 or newer. The longer background moves here instead. Any override (version, srcHash/cargoHash, or overrideAttrs such as the previous postPatch) changes the derivation hash, so Nix can no longer substitute it and compiles pnpm's Rust sources. On the 4-core GitHub-hosted ubuntu-24.04-arm runner that publishes to npm, that build took about 25 minutes (1592s in run 38093918704). The publish job has to stay on a GitHub-hosted runner for npm provenance, so a bigger runner is not an option there. If a future pnpm feature needs a version newer than nixpkgs ships, prefer bumping the pnpm-nixpkgs input over reintroducing an override.
5a5c8ee to
af6a70c
Compare
|
@coderabbitai review |
@ryoppippi I have started the AI code review. It will take a few minutes to complete. |
|
|
|
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |
ccusage performance comparisonPR SHA: Performance comparison skipped. Base package URL was not ready before 300.000s. Fixture performance comparison requires a base package when --base-dir is not provided. Base package: |

Summary
Stop building pnpm from source in CI.
nix/pnpm.nixnow exposes nixpkgs' ownpnpm_12build unmodified, so it is substituted from cache.nixos.org instead of compiled. This takes the releasenpmjob back from ~27 minutes to roughly its previous ~1.5 minutes.Why
The release workflow's
npmjob recently became the long pole of every release:npmjobnix profile install .#pnpm .#publintEvery other job (tagpr, the six native builds, changelog) was unchanged at a few minutes each.
#1792 pinned pnpm to 12.8.1 through
pnpm_12.override { version; srcHash; cargoHash; }plus anoverrideAttrspostPatch, because the nixpkgs pnpm at that time predatedautoDedupe. Any override changes the derivation hash, so Nix can no longer substitute it and has to compile pnpm's Rust sources. The publish job runs on the 4-core GitHub-hostedubuntu-24.04-armrunner (it must stay GitHub-hosted for npm--provenance), where that build takes about 25 minutes. #1844 then raised the job timeout from 10 to 45 minutes to fit the build.The
cache-nix-actionstore cache did not help either.pnpm-nixpkgsfollowsnixpkgs-unstable, so routine lock updates change the pnpm derivation between releases. In the two Oct 10 runs, the first builtjxwx2…-pnpm-12.8.1.drvand saved it to the cache; the second restored that cache but neededal533…-pnpm-12.8.1.drvand rebuilt from scratch. Because releases are infrequent, nearly every release hits a cold build.The locked
pnpm-nixpkgsnow shipspnpm_1212.9.0, which is newer than the 12.8.1 floor thatautoDedupeneeds, so the override is no longer necessary.What Changed
nix/pnpm.nix: drop the version override andpostPatch;packages.pnpmis nowinputs.pnpm-nixpkgs.legacyPackages.${system}.pnpm_12as is. The comment is reduced to the two constraints: keep the package unmodified so it stays substitutable, and keep pnpm at 12.8.1 or newer forautoDedupe..github/workflows/release.yaml: thenpmjob keeps its 45-minute timeout. Only the comment attributing the timeout to a from-source pnpm build is removed, because that is no longer true.Impact
npmjob no longer compiles pnpm on a cache miss.JS teststep and the pkg-pr-new job inci.yaml, plusupdate-pricing.yamlandcheck-links.yaml, install the same.#pnpm, so they also stop paying the build cost on a cache miss.package.jsonstill pinspackageManager: [email protected], the same kind of mismatch that already existed with 12.8.1.Follow-up guidance
If a future pnpm feature needs a version newer than nixpkgs ships, bump the
pnpm-nixpkgsinput rather than reintroducing an override, or the from-source build comes back.Testing
nix build .#pnpmfetched/nix/store/6vnrsxp5zmq5chqqvrflhsk3dw9w941s-pnpm-12.9.0from cache.nixos.org without building anything.nix path-info --store https://cache.nixos.orgconfirms the.#pnpmoutput is cached for aarch64-linux, x86_64-linux, and aarch64-darwin; this was rechecked after rebasing onto main with chore(deps): lock file maintenance #1870 and chore(deps): lock file maintenance #1877.pnpm install --frozen-lockfilewith that pnpm succeeds and leavespnpm-lock.yamlunchanged.nix fmt -- nix/pnpm.nixreports no changes.nix develop.