From 01119bd7415df642b991a768aba1072558913233 Mon Sep 17 00:00:00 2001 From: Diogo Correia Date: Thu, 30 Jul 2026 20:04:31 +0100 Subject: [PATCH 1/4] pnpm_12: init at 12.3.4 (cherry picked from commit e351ab90ce70906e787f6de918c2d32715ad9cff) --- pkgs/development/tools/pnpm/default.nix | 11 +- pkgs/development/tools/pnpm/generic-rust.nix | 108 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 1 + 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/tools/pnpm/generic-rust.nix diff --git a/pkgs/development/tools/pnpm/default.nix b/pkgs/development/tools/pnpm/default.nix index 27a71f849f8d..3ecf04095eb7 100644 --- a/pkgs/development/tools/pnpm/default.nix +++ b/pkgs/development/tools/pnpm/default.nix @@ -56,9 +56,14 @@ let version = "11.25.0"; hash = "sha256-M90HSPJ+eRbE8ci2lDRhmD40U7BrvaYxKmKAEwtIgeU="; }; + "12" = { + version = "12.3.4"; + srcHash = "sha256-EAF5ZeABBX4Wdn08OVria9zKcTIJ8i9EIjb9gsaCAo4="; + cargoHash = "sha256-I54W1Ig6mn3/BsBiL5qc8aUZmSY2IGEY2QSXG0V1W1w="; + }; }; - callPnpm = + callPnpmNode = variant: callPackage ./generic.nix ( variant @@ -68,6 +73,10 @@ let } ); + callPnpmRust = callPackage ./generic-rust.nix; + + callPnpm = variant: if variant ? cargoHash then callPnpmRust variant else callPnpmNode variant; + mkPnpm = versionSuffix: variant: nameValuePair "pnpm_${versionSuffix}" (callPnpm variant); in mapAttrs' mkPnpm variants diff --git a/pkgs/development/tools/pnpm/generic-rust.nix b/pkgs/development/tools/pnpm/generic-rust.nix new file mode 100644 index 000000000000..48870af49b05 --- /dev/null +++ b/pkgs/development/tools/pnpm/generic-rust.nix @@ -0,0 +1,108 @@ +{ + lib, + fetchFromGitHub, + installShellFiles, + makeWrapper, + nodejs-slim, + rustPackages_1_97, + stdenv, + testers, + tests, + writeScript, + + version, + srcHash, + cargoHash, + knownVulnerabilities ? [ ], +}: +let + majorVersion = lib.versions.major version; +in +rustPackages_1_97.rustPlatform.buildRustPackage (finalAttrs: { + pname = "pnpm"; + inherit version cargoHash; + + src = fetchFromGitHub { + owner = "pnpm"; + repo = "pnpm"; + tag = "v${version}"; + hash = srcHash; + }; + + nativeBuildInputs = [ + installShellFiles + makeWrapper + ]; + + cargoBuildFlags = [ + "--bin=pnpm" + ]; + + postInstall = '' + makeWrapper "$out"/bin/pnpm "$out"/bin/pnpx \ + --add-flag "dlx" + + ln -s "$out"/bin/pnpm "$out"/bin/pn + ln -s "$out"/bin/pnpx "$out"/bin/pnx + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + "$out"/bin/pnpm completion bash > pnpm.bash + "$out"/bin/pnpm completion fish > pnpm.fish + "$out"/bin/pnpm completion zsh > pnpm.zsh + installShellCompletion pnpm.{bash,fish,zsh} + ''; + + passthru = { + inherit majorVersion nodejs-slim; + + tests = { + inherit (tests) pnpm; + version = testers.testVersion { package = finalAttrs.finalPackage; }; + }; + + updateScript = writeScript "pnpm-update-script" '' + #!/usr/bin/env nix-shell + #!nix-shell --pure --keep GITHUB_TOKEN -i bash -p curl cacert jq nix-update git + set -eou pipefail + + curl_github() { + curl -L ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "$@" + } + + latestTag=$( + curl_github https://api.github.com/repos/pnpm/pnpm/releases?per_page=100 | \ + jq -r --arg major "v${majorVersion}" \ + '[.[] | select(.tag_name | startswith($major)) | select(.prerelease == false)][0].tag_name' + ) + + # Exit if there is no tag with this major version + if [ "$latestTag" = "null" ]; then + echo "No releases starting with v${majorVersion}" + exit 0 + fi + + latestVersion="''${latestTag#v}" + + nix-update pnpm_${majorVersion} --version="$latestVersion" --override-filename=./pkgs/development/tools/pnpm/default.nix + ''; + }; + + strictDeps = true; + __structuredAttrs = true; + + # Tests take way too long to run + doCheck = false; + + meta = { + description = "Fast, disk space efficient package manager for JavaScript"; + homepage = "https://pnpm.io/"; + changelog = "https://github.com/pnpm/pnpm/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + Scrumplex + gepbird + ]; + mainProgram = "pnpm"; + inherit knownVulnerabilities; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 772e69d5b3ff..9276a296a5ae 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2967,6 +2967,7 @@ with pkgs; pnpm_10_29_2 pnpm_10 pnpm_11 + pnpm_12 ; pnpm = pnpm_11; From 03c5d2ad52c1022554505b9b50256a3f89ff1ca4 Mon Sep 17 00:00:00 2001 From: Diogo Correia Date: Fri, 31 Jul 2026 16:45:43 +0100 Subject: [PATCH 2/4] fetch-pnpm-deps: add support for pnpm 12 (cherry picked from commit 3795763b4239449942610d3aa2d92397d51d193f) --- .../node/fetch-pnpm-deps/default.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/node/fetch-pnpm-deps/default.nix b/pkgs/build-support/node/fetch-pnpm-deps/default.nix index 3f6f517c58d4..eae7a575928e 100644 --- a/pkgs/build-support/node/fetch-pnpm-deps/default.nix +++ b/pkgs/build-support/node/fetch-pnpm-deps/default.nix @@ -69,7 +69,7 @@ in ) true; lib.warnIf (fetcherVersion < 3) - "fetchPnpmDeps: `fetcherVersion = ${toString fetcherVersion}` is deprecated and scheduled for removal in the 26.11 release. Please migrate `${pname}` to `fetcherVersion = 3` and regenerate the hash. See https://nixos.org/manual/nixpkgs/stable/#javascript-pnpm-fetcherVersion." + "fetchPnpmDeps: `fetcherVersion = ${toString fetcherVersion}` is deprecated and scheduled for removal in the 26.11 release. Please migrate `${pname}` to `fetcherVersion = 4` and regenerate the hash. See https://nixos.org/manual/nixpkgs/stable/#javascript-pnpm-fetcherVersion." stdenvNoCC.mkDerivation ( @@ -84,6 +84,7 @@ in jq moreutils pnpm # from args + pnpm.nodejs-slim pnpm-fixup-state-db' sqlite writableTmpDirAsHomeHook @@ -148,13 +149,20 @@ in # pnpm is going to warn us about using --force # --force allows us to fetch all dependencies including ones that aren't meant for our host platform + local installFlagsArray=( + "--force" + "--ignore-scripts" + "--frozen-lockfile" + ) + + if [[ -n "$NIX_NPM_REGISTRY" ]]; then + installFlagsArray+=("--registry=$NIX_NPM_REGISTRY") + fi + pnpm install \ - --force \ - --ignore-scripts \ ${lib.escapeShellArgs filterFlags} \ ${lib.escapeShellArgs pnpmInstallFlags} \ - --registry="$NIX_NPM_REGISTRY" \ - --frozen-lockfile + "''${installFlagsArray[@]}" # Store newer fetcherVersion in case pnpmConfigHook also needs it if [[ ${toString fetcherVersion} -gt 1 ]]; then From 05b188e5e946f466fa36fc75793a96b93016ecf5 Mon Sep 17 00:00:00 2001 From: Diogo Correia Date: Sun, 6 Sep 2026 22:46:46 +0100 Subject: [PATCH 3/4] pnpm_11: fix curl GITHUB_TOKEN parameter on update script (cherry picked from commit e97c70d3e2e777ddff111564204bdb9f1edfa827) --- pkgs/development/tools/pnpm/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/pnpm/generic.nix b/pkgs/development/tools/pnpm/generic.nix index 5958e8787fe0..0f6e5fe36d3a 100644 --- a/pkgs/development/tools/pnpm/generic.nix +++ b/pkgs/development/tools/pnpm/generic.nix @@ -135,7 +135,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { set -eou pipefail curl_github() { - curl -L ''${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "$@" + curl -L ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "$@" } latestTag=$( From 39bd700221aed592680d2974ae58cbb8a6fa1a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Fri, 11 Sep 2026 13:16:43 +0200 Subject: [PATCH 4/4] tests/pnpm: add test for pnpm 12 (cherry picked from commit feccedc4bf7aa9651b8258dd07e2b87ffad1cec1) --- pkgs/test/pnpm/default.nix | 1 + pkgs/test/pnpm/pnpm_12_v4/default.nix | 60 ++++++++++++++++++++ pkgs/test/pnpm/pnpm_12_v4/src/.gitignore | 2 + pkgs/test/pnpm/pnpm_12_v4/src/index.ts | 1 + pkgs/test/pnpm/pnpm_12_v4/src/package.json | 20 +++++++ pkgs/test/pnpm/pnpm_12_v4/src/pnpm-lock.yaml | 39 +++++++++++++ pkgs/test/pnpm/pnpm_12_v4/src/tsconfig.json | 13 +++++ 7 files changed, 136 insertions(+) create mode 100644 pkgs/test/pnpm/pnpm_12_v4/default.nix create mode 100644 pkgs/test/pnpm/pnpm_12_v4/src/.gitignore create mode 100644 pkgs/test/pnpm/pnpm_12_v4/src/index.ts create mode 100644 pkgs/test/pnpm/pnpm_12_v4/src/package.json create mode 100644 pkgs/test/pnpm/pnpm_12_v4/src/pnpm-lock.yaml create mode 100644 pkgs/test/pnpm/pnpm_12_v4/src/tsconfig.json diff --git a/pkgs/test/pnpm/default.nix b/pkgs/test/pnpm/default.nix index 27938a8a0405..0d552c7c86d2 100644 --- a/pkgs/test/pnpm/default.nix +++ b/pkgs/test/pnpm/default.nix @@ -5,4 +5,5 @@ pnpm-workspaces = lib.recurseIntoAttrs (callPackage ./pnpm-workspaces { }); pnpm_11_v3 = callPackage ./pnpm_11_v3 { }; pnpm_11_v4 = callPackage ./pnpm_11_v4 { }; + pnpm_12_v4 = callPackage ./pnpm_12_v4 { }; } diff --git a/pkgs/test/pnpm/pnpm_12_v4/default.nix b/pkgs/test/pnpm/pnpm_12_v4/default.nix new file mode 100644 index 000000000000..0106a8054cc1 --- /dev/null +++ b/pkgs/test/pnpm/pnpm_12_v4/default.nix @@ -0,0 +1,60 @@ +{ + fetchPnpmDeps, + lib, + makeShellWrapper, + nodejs-slim, + pnpmConfigHook, + pnpm_12, + stdenv, + testers, +}: +let + pnpm = pnpm_12; +in +stdenv.mkDerivation (finalAttrs: { + pname = "pnpm-test"; + inherit (pnpm) version; + + src = ./src; + + pnpmDeps = testers.invalidateFetcherByDrvHash fetchPnpmDeps { + inherit (finalAttrs) pname version src; + inherit pnpm; + fetcherVersion = 4; + hash = "sha256-NDGKyqZasK13YkmNQ1ypP14rCP8wp2llT8bnKUi4/zo="; + }; + + nativeBuildInputs = [ + makeShellWrapper + nodejs-slim + pnpm + pnpmConfigHook + ]; + + buildPhase = '' + runHook preBuild + + pnpm build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -Dm644 -t $out/lib/pnpm-12-test dist/index.js + + makeWrapper ${lib.getExe nodejs-slim} $out/bin/pnpm-12-test \ + --add-flags "$out/lib/pnpm-12-test" + + runHook postInstall + ''; + + __structuredAttrs = true; + + meta = { + license = lib.licenses.mit; + mainProgram = "pnpm-12-test"; + inherit (pnpm.meta) maintainers; + }; +}) diff --git a/pkgs/test/pnpm/pnpm_12_v4/src/.gitignore b/pkgs/test/pnpm/pnpm_12_v4/src/.gitignore new file mode 100644 index 000000000000..1eae0cf6700c --- /dev/null +++ b/pkgs/test/pnpm/pnpm_12_v4/src/.gitignore @@ -0,0 +1,2 @@ +dist/ +node_modules/ diff --git a/pkgs/test/pnpm/pnpm_12_v4/src/index.ts b/pkgs/test/pnpm/pnpm_12_v4/src/index.ts new file mode 100644 index 000000000000..accefceba62b --- /dev/null +++ b/pkgs/test/pnpm/pnpm_12_v4/src/index.ts @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/pkgs/test/pnpm/pnpm_12_v4/src/package.json b/pkgs/test/pnpm/pnpm_12_v4/src/package.json new file mode 100644 index 000000000000..db1ebc211925 --- /dev/null +++ b/pkgs/test/pnpm/pnpm_12_v4/src/package.json @@ -0,0 +1,20 @@ +{ + "name": "pnpm12test", + "version": "1.0.0", + "description": "", + "main": "dist/index.js", + "scripts": { + "build": "tsc", + "start": "node dist/index.js" + }, + "license": "MIT", + "packageManager": "pnpm", + "type": "module", + "files": [ + "dist/" + ], + "devDependencies": { + "@types/node": "^25.5.0", + "typescript": "^6.0.2" + } +} diff --git a/pkgs/test/pnpm/pnpm_12_v4/src/pnpm-lock.yaml b/pkgs/test/pnpm/pnpm_12_v4/src/pnpm-lock.yaml new file mode 100644 index 000000000000..9443db3a4077 --- /dev/null +++ b/pkgs/test/pnpm/pnpm_12_v4/src/pnpm-lock.yaml @@ -0,0 +1,39 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@types/node': + specifier: ^25.5.0 + version: 25.9.6 + typescript: + specifier: ^6.0.2 + version: 6.0.3 + +packages: + + '@types/node@25.9.6': + resolution: {integrity: sha512-JR6Q/PV5DKFvjrGFVqQJdeG0qvsqQQLDa3TzFrqVwhqRXqwNaxPo2KYCtCQXpOdIulCouKwT7a6in9nFthBAzw==} + + typescript@6.0.3: + resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + +snapshots: + + '@types/node@25.9.6': + dependencies: + undici-types: 7.24.6 + + typescript@6.0.3: {} + + undici-types@7.24.6: {} diff --git a/pkgs/test/pnpm/pnpm_12_v4/src/tsconfig.json b/pkgs/test/pnpm/pnpm_12_v4/src/tsconfig.json new file mode 100644 index 000000000000..3471bd329666 --- /dev/null +++ b/pkgs/test/pnpm/pnpm_12_v4/src/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "dist", + "rootDir": ".", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + } +}