Skip to content

Commit 59acba6

Browse files
authored
pnpm.fetchDeps: ignore packageManager field in package.json (#388252)
2 parents 21e4b75 + 0a0418c commit 59acba6

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

pkgs/by-name/ve/vencord/package.nix

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,12 @@
77
lib,
88
nix-update,
99
nodejs,
10-
pnpm,
11-
fetchurl,
10+
pnpm_10,
1211
stdenv,
1312
writeShellScript,
1413
buildWebExtension ? false,
1514
}:
16-
let
17-
# Credit to: @ScarsTRF (https://github.com/ScarsTRF/nixcord/blob/652dc8067b8004517ea43ebcc8d93a64f95d4327/vencord.nix#L28-L37)
18-
# Due to pnpm package 10.5.2 there is a issue when building.
19-
# Substituting pnpm with version 10.4.1 fixes this issue.
20-
# This should be fixed in a newer version of pnpm.
21-
pnpm_10-4 = pnpm.overrideAttrs (oldAttrs: {
22-
version = "10.4.1";
23-
src = fetchurl {
24-
url = "https://registry.npmjs.org/pnpm/-/pnpm-10.4.1.tgz";
25-
sha256 = "sha256-S3Aoh5hplZM9QwCDawTW0CpDvHK1Lk9+k6TKYIuVkZc=";
26-
};
27-
});
28-
in
15+
2916
stdenv.mkDerivation (finalAttrs: {
3017
pname = "vencord";
3118
version = "1.11.6";
@@ -37,15 +24,15 @@ stdenv.mkDerivation (finalAttrs: {
3724
hash = "sha256-8KAt7yFGT/DBlg2VJ7ejsOJ67Sp5cuuaKEWK3+VpL4E=";
3825
};
3926

40-
pnpmDeps = pnpm_10-4.fetchDeps {
27+
pnpmDeps = pnpm_10.fetchDeps {
4128
inherit (finalAttrs) pname src;
4229
hash = "sha256-g9BSVUKpn74D9eIDj/lS1Y6w/+AnhCw++st4s4REn+A=";
4330
};
4431

4532
nativeBuildInputs = [
4633
git
4734
nodejs
48-
pnpm_10-4.configHook
35+
pnpm_10.configHook
4936
];
5037

5138
env = {

pkgs/development/tools/pnpm/fetch-deps/default.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@
6868
fi
6969
7070
export HOME=$(mktemp -d)
71+
72+
# If the packageManager field in package.json is set to a different pnpm version than what is in nixpkgs,
73+
# any pnpm command would fail in that directory, the following disables this
74+
pushd ..
75+
pnpm config set manage-package-manager-versions false
76+
popd
77+
7178
pnpm config set store-dir $out
7279
# Some packages produce platform dependent outputs. We do not want to cache those in the global store
7380
pnpm config set side-effects-cache false

pkgs/development/tools/pnpm/fetch-deps/pnpm-config-hook.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ pnpmConfigHook() {
2020
cp -Tr "$pnpmDeps" "$STORE_PATH"
2121
chmod -R +w "$STORE_PATH"
2222

23+
24+
# If the packageManager field in package.json is set to a different pnpm version than what is in nixpkgs,
25+
# any pnpm command would fail in that directory, the following disables this
26+
pushd ..
27+
pnpm config set manage-package-manager-versions false
28+
popd
29+
2330
pnpm config set store-dir "$STORE_PATH"
2431

2532
if [[ -n "$pnpmWorkspace" ]]; then

0 commit comments

Comments
 (0)