Unverified Commit 0eec779f authored by Sefa Eyeoglu's avatar Sefa Eyeoglu Committed by GitHub
Browse files

pnpm.fetchDeps: ensure consistent permissions, add versioning (#422975)

parents e77f66ad 71e3980f
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -444,6 +444,7 @@ stdenv.mkDerivation (finalAttrs: {
  pnpmDeps = pnpm.fetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "...";
    fetcherVersion = 2;
  };
})
```
@@ -558,6 +559,41 @@ set `prePnpmInstall` to the right commands to run. For example:

In this example, `prePnpmInstall` will be run by both `pnpm.configHook` and by the `pnpm.fetchDeps` builder.

#### PNPM `fetcherVersion` {#javascript-pnpm-fetcherVersion}

This is the version of the output of `pnpm.fetchDeps`, if you haven't set it already, you can use `1` with your current hash:

```nix
{
  # ...
  pnpmDeps = pnpm.fetchDeps {
    # ...
    hash = "..."; # you can use your already set hash here
    fetcherVersion = 1;
  };
}
```

After upgrading to a newer `fetcherVersion`, you need to regenerate the hash:

```nix
{
  # ...
  pnpmDeps = pnpm.fetchDeps {
    # ...
    hash = "..."; # clear this hash and generate a new one
    fetcherVersion = 2;
  };
}
```

This variable ensures that we can make changes to the output of `pnpm.fetchDeps` without breaking existing hashes.
Changes can include workarounds or bug fixes to existing PNPM issues.

##### Version history {#javascript-pnpm-fetcherVersion-versionHistory}

- 1: Initial version, nothing special
- 2: [Ensure consistent permissions](https://github.com/NixOS/nixpkgs/pull/422975)

### Yarn {#javascript-yarn}

+6 −0
Original line number Diff line number Diff line
@@ -3347,6 +3347,12 @@
  "javascript-pnpm-extraCommands": [
    "index.html#javascript-pnpm-extraCommands"
  ],
  "javascript-pnpm-fetcherVersion": [
    "index.html#javascript-pnpm-fetcherVersion"
  ],
  "javascript-pnpm-fetcherVersion-versionHistory": [
    "index.html#javascript-pnpm-fetcherVersion-versionHistory"
  ],
  "javascript-yarn": [
    "index.html#javascript-yarn"
  ],
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ stdenv.mkDerivation (finalAttrs: {
  pnpmDeps = pnpm.fetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "sha256-xIQyTetHU37gTxCcQp4VCqzGdIfVQGy/aORCVba6YQ0=";
    fetcherVersion = 1;
  };

  nativeBuildInputs = [
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
  pnpmDeps = pnpm_8.fetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "sha256-h1rcM+H2c0lk7bpGeQT5ue9bQIggrCFHkj4o7KxnH08=";
    fetcherVersion = 1;
  };

  cargoRoot = "src-tauri";
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ buildGoModule rec {
      inherit src version pname;
      sourceRoot = "${src.name}/ui";
      hash = "sha256-/se6IWeHdazqS7PzOpgtT4IxCJ1WptqBzZ/BdmGb4BA=";
      fetcherVersion = 1;
    };

    nativeBuildInputs = [
Loading