about summary refs log tree commit diff
path: root/pkgs/by-name/ve/vesktop/package.nix
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-11-05 14:45:28 +0100
committerSefa Eyeoglu <contact@scrumplex.net>2023-11-06 09:55:40 +0100
commit2f9b68dbebf7095ffcdc2bb6a94ae7d98b1536b9 (patch)
tree34311b354e8b8edfa0516488a6d7afcae1b749f4 /pkgs/by-name/ve/vesktop/package.nix
parent1809b328770806f94d306799147cc1a847d5328f (diff)
vesktop: use a single store for all supported platforms
pnpm 8.10.0 introduced a feature that allows downloading npm deps for
other platforms. Sadly, this is a package.json option currently, but
using a simple patch with jq we can leverage this feature, to have a
single output hash for all supported platforms for our pnpm
dependencies. This might be one step forward towards an eventual
fetchPnpmDeps build-support function.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'pkgs/by-name/ve/vesktop/package.nix')
-rw-r--r--pkgs/by-name/ve/vesktop/package.nix20
1 files changed, 16 insertions, 4 deletions
diff --git a/pkgs/by-name/ve/vesktop/package.nix b/pkgs/by-name/ve/vesktop/package.nix
index 0992f6612e98f..38c5785327451 100644
--- a/pkgs/by-name/ve/vesktop/package.nix
+++ b/pkgs/by-name/ve/vesktop/package.nix
@@ -37,6 +37,20 @@ stdenv.mkDerivation rec {
       nodePackages.pnpm
     ];
 
+    # NOTE: This requires pnpm 8.10.0 or newer
+    # https://github.com/pnpm/pnpm/pull/7214
+    pnpmPatch = builtins.toJSON {
+      pnpm.supportedArchitectures = {
+        os = [ "linux" ];
+        cpu = [ "x64" "arm64" ];
+      };
+    };
+
+    postPatch = ''
+      mv package.json package.json.orig
+      jq --raw-output ". * $pnpmPatch" package.json.orig > package.json
+    '';
+
     # https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56
     installPhase = ''
       export HOME=$(mktemp -d)
@@ -51,12 +65,10 @@ stdenv.mkDerivation rec {
       done
     '';
 
+    dontBuild = true;
     dontFixup = true;
     outputHashMode = "recursive";
-    outputHash = {
-      "aarch64-linux" = "sha256-OcAQbUi+wpBAumncYxP3qtTzjyxiHL69kbQefwaeBfg=";
-      "x86_64-linux" = "sha256-R5/2MSH/jXHrj2x1Ap2OoOFLBLQp3Sq91o01uW8hWOw=";
-    }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
+    outputHash = "sha256-nNXe0vSQiQTkiRqgScKlpkpG/BJc2eIY2ueAd9sk36c=";
   };
 
   nativeBuildInputs = [