about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/element
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2024-05-01 09:25:39 +0200
committerJörg Thalheim <joerg@thalheim.io>2024-05-10 15:48:33 +0000
commite1b9b3e251e61e8c0bb7e2da6b55257b42a34757 (patch)
tree8cfd8bb7deddfc11717e4b7f15e912d1a548e50b /pkgs/applications/networking/instant-messengers/element
parentff8042515983b75db625af3454f3faa2a5f9ffa9 (diff)
element-desktop: fix cross build
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/element')
-rw-r--r--pkgs/applications/networking/instant-messengers/element/keytar/default.nix13
-rw-r--r--pkgs/applications/networking/instant-messengers/element/seshat/default.nix4
2 files changed, 14 insertions, 3 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
diff --git a/pkgs/applications/networking/instant-messengers/element/seshat/default.nix b/pkgs/applications/networking/instant-messengers/element/seshat/default.nix
index ed6b5ebe72a65..c1c9a57d43569 100644
--- a/pkgs/applications/networking/instant-messengers/element/seshat/default.nix
+++ b/pkgs/applications/networking/instant-messengers/element/seshat/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, rustPlatform, fetchFromGitHub, callPackage, sqlcipher, nodejs, python3, yarn, fixup-yarn-lock, CoreServices, fetchYarnDeps, removeReferencesTo }:
+{ lib, stdenv, rustPlatform, fetchFromGitHub, rust, sqlcipher, nodejs, python3, yarn, fixup-yarn-lock, CoreServices, fetchYarnDeps, removeReferencesTo }:
 
 let
   pinData = lib.importJSON ./pin.json;
@@ -36,7 +36,7 @@ in rustPlatform.buildRustPackage rec {
     fixup-yarn-lock yarn.lock
     yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
     patchShebangs node_modules/
-    node_modules/.bin/neon build --release
+    node_modules/.bin/neon build --release -- --target ${rust.toRustTargetSpec stdenv.hostPlatform} -Z unstable-options --out-dir target/release
     runHook postBuild
   '';