Unverified Commit 59acba6d authored by Sefa Eyeoglu's avatar Sefa Eyeoglu Committed by GitHub
Browse files

pnpm.fetchDeps: ignore packageManager field in package.json (#388252)

parents 21e4b751 0a0418c1
Loading
Loading
Loading
Loading
+4 −17
Original line number Diff line number Diff line
@@ -7,25 +7,12 @@
  lib,
  nix-update,
  nodejs,
  pnpm,
  fetchurl,
  pnpm_10,
  stdenv,
  writeShellScript,
  buildWebExtension ? false,
}:
let
  # Credit to: @ScarsTRF (https://github.com/ScarsTRF/nixcord/blob/652dc8067b8004517ea43ebcc8d93a64f95d4327/vencord.nix#L28-L37)
  # Due to pnpm package 10.5.2 there is a issue when building.
  # Substituting pnpm with version 10.4.1 fixes this issue.
  # This should be fixed in a newer version of pnpm.
  pnpm_10-4 = pnpm.overrideAttrs (oldAttrs: {
    version = "10.4.1";
    src = fetchurl {
      url = "https://registry.npmjs.org/pnpm/-/pnpm-10.4.1.tgz";
      sha256 = "sha256-S3Aoh5hplZM9QwCDawTW0CpDvHK1Lk9+k6TKYIuVkZc=";
    };
  });
in

stdenv.mkDerivation (finalAttrs: {
  pname = "vencord";
  version = "1.11.6";
@@ -37,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-8KAt7yFGT/DBlg2VJ7ejsOJ67Sp5cuuaKEWK3+VpL4E=";
  };

  pnpmDeps = pnpm_10-4.fetchDeps {
  pnpmDeps = pnpm_10.fetchDeps {
    inherit (finalAttrs) pname src;
    hash = "sha256-g9BSVUKpn74D9eIDj/lS1Y6w/+AnhCw++st4s4REn+A=";
  };
@@ -45,7 +32,7 @@ stdenv.mkDerivation (finalAttrs: {
  nativeBuildInputs = [
    git
    nodejs
    pnpm_10-4.configHook
    pnpm_10.configHook
  ];

  env = {
+7 −0
Original line number Diff line number Diff line
@@ -68,6 +68,13 @@
            fi

            export HOME=$(mktemp -d)

            # If the packageManager field in package.json is set to a different pnpm version than what is in nixpkgs,
            # any pnpm command would fail in that directory, the following disables this
            pushd ..
            pnpm config set manage-package-manager-versions false
            popd

            pnpm config set store-dir $out
            # Some packages produce platform dependent outputs. We do not want to cache those in the global store
            pnpm config set side-effects-cache false
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@ pnpmConfigHook() {
    cp -Tr "$pnpmDeps" "$STORE_PATH"
    chmod -R +w "$STORE_PATH"


    # If the packageManager field in package.json is set to a different pnpm version than what is in nixpkgs,
    # any pnpm command would fail in that directory, the following disables this
    pushd ..
    pnpm config set manage-package-manager-versions false
    popd

    pnpm config set store-dir "$STORE_PATH"

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