Skip to content

fix(nix): use the cached nixpkgs pnpm build - #1878

Merged
ryoppippi merged 3 commits into
mainfrom
t3code/speed-release-ci
Oct 13, 2026
Merged

ryoppippi merged 3 commits into
mainfrom
t3code/speed-release-ci

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Stop building pnpm from source in CI. nix/pnpm.nix now exposes nixpkgs' own pnpm_12 build unmodified, so it is substituted from cache.nixos.org instead of compiled. This takes the release npm job back from ~27 minutes to roughly its previous ~1.5 minutes.

Why

The release workflow's npm job recently became the long pole of every release:

Run npm job nix profile install .#pnpm .#publint
35279983209 (Sep 17, before #1792) 1.4 min 3 s
38010098401 (Oct 10) 26.6 min ~26 min
38093918704 (Oct 10) 28.6 min 1592 s

Every 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 an overrideAttrs postPatch, because the nixpkgs pnpm at that time predated autoDedupe. 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-hosted ubuntu-24.04-arm runner (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-action store cache did not help either. pnpm-nixpkgs follows nixpkgs-unstable, so routine lock updates change the pnpm derivation between releases. In the two Oct 10 runs, the first built jxwx2…-pnpm-12.8.1.drv and saved it to the cache; the second restored that cache but needed al533…-pnpm-12.8.1.drv and rebuilt from scratch. Because releases are infrequent, nearly every release hits a cold build.

The locked pnpm-nixpkgs now ships pnpm_12 12.9.0, which is newer than the 12.8.1 floor that autoDedupe needs, so the override is no longer necessary.

What Changed

  • nix/pnpm.nix: drop the version override and postPatch; packages.pnpm is now inputs.pnpm-nixpkgs.legacyPackages.${system}.pnpm_12 as 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 for autoDedupe.
  • .github/workflows/release.yaml: the npm job 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

  • Release: the npm job no longer compiles pnpm on a cache miss.
  • CI: the JS test step and the pkg-pr-new job in ci.yaml, plus update-pricing.yaml and check-links.yaml, install the same .#pnpm, so they also stop paying the build cost on a cache miss.
  • Local dev shells on aarch64-darwin and Linux fetch pnpm instead of building it.
  • x86_64-darwin is not built by Hydra anymore, so it still builds pnpm from source there, which is the same as before this change. No CI or release job evaluates pnpm for x86_64-darwin.
  • pnpm moves from 12.8.1 to 12.9.0 in Nix. package.json still pins packageManager: [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-nixpkgs input rather than reintroducing an override, or the from-source build comes back.

Testing

  • nix build .#pnpm fetched /nix/store/6vnrsxp5zmq5chqqvrflhsk3dw9w941s-pnpm-12.9.0 from cache.nixos.org without building anything.
  • nix path-info --store https://cache.nixos.org confirms the .#pnpm output 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-lockfile with that pnpm succeeds and leaves pnpm-lock.yaml unchanged.
  • nix fmt -- nix/pnpm.nix reports no changes.
  • Commit and pre-push hooks (gitleaks, commit scope, treefmt) passed inside nix develop.
  • The end-to-end release timing can only be confirmed on the next release run.

@pullfrog

pullfrog Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

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.
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review
@cubic-dev-ai review

@ryoppippi
ryoppippi force-pushed the t3code/speed-release-ci branch from 7c3eabb to dad3a9d Compare October 13, 2026 19:58
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1ae5e1c-4910-46e8-bc00-b6f2e298a7b7
📥 Commits

Reviewing files that changed from the base of the PR and between c39aa6e and 9eed66a.

📒 Files selected for processing: 2
  • .github/workflows/release.yaml
  • nix/pnpm.nix
 __________________________________________________________________________
< Mirror, mirror on the wall, who's the best AI code reviewer of them all? >
 --------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review
@cubic-dev-ai review

@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.
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review
@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review
@cubic-dev-ai 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.
@ryoppippi
ryoppippi force-pushed the t3code/speed-release-ci branch from 5a5c8ee to af6a70c Compare October 13, 2026 20:02
@ryoppippi

Copy link
Copy Markdown
Member Author

@coderabbitai review
@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review
@cubic-dev-ai review

@ryoppippi I have started the AI code review. It will take a few minutes to complete.

@ryoppippi
ryoppippi merged commit c4a5483 into main Oct 13, 2026
15 checks passed
@ryoppippi
ryoppippi deleted the t3code/speed-release-ci branch October 13, 2026 20:03
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: dad3a9d3079a
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7c3eabb79d5b
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: dad3a9d3079a
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 5a5c8eee148e
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 5a5c8eee148e
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 9eed66a1aae0
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 9eed66a1aae0
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: af6a70c9fcf3
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: af6a70c9fcf3
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 7c3eabb79d5b
Base SHA: c39aa6ea5d07

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: c39aa6ea5d07

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.

1 participant