about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/element/keytar/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/element/keytar/default.nix')
-rw-r--r--pkgs/applications/networking/instant-messengers/element/keytar/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix
index 84196371be3af..d43894e08239a 100644
--- a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix
+++ b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, nodejs, python3, callPackage, removeReferencesTo
+{ lib, stdenv, fetchFromGitHub, nodejs, python3, removeReferencesTo
 , pkg-config, libsecret, xcbuild, Security, AppKit, fetchNpmDeps, npmHooks }:
 
 let
@@ -31,6 +31,17 @@ in stdenv.mkDerivation rec {
 
   doCheck = false;
 
+  postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    pkg-config() { "''${PKG_CONFIG}" "$@"; }
+    export -f pkg-config
+  '';
+
+  # https://nodejs.org/api/os.html#osarch
+  npmFlagsArray = [ "--arch=${if stdenv.hostPlatform.parsed.cpu.name == "i686" then "ia32"
+                             else if stdenv.hostPlatform.parsed.cpu.name == "x86_64" then "x64"
+                             else if stdenv.hostPlatform.parsed.cpu.name == "aarch64" then "arm64"
+                             else stdenv.hostPlatform.parsed.cpu.name}" ];
+
   installPhase = ''
     runHook preInstall
     shopt -s extglob