From e1b9b3e251e61e8c0bb7e2da6b55257b42a34757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 1 May 2024 09:25:39 +0200 Subject: [PATCH 1/3] element-desktop: fix cross build --- .../instant-messengers/element/keytar/default.nix | 13 ++++++++++++- .../instant-messengers/element/seshat/default.nix | 4 ++-- 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 84196371be3a..d43894e08239 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 ed6b5ebe72a6..c1c9a57d4356 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 ''; From 2fe65e94c1d09047ed0d65fef82891c5aea8a4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 1 May 2024 11:23:08 +0200 Subject: [PATCH 2/3] electron: fix cross compilation --- .../networking/browsers/chromium/common.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index 20e987facdc3..5770456f177f 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -20,6 +20,7 @@ , pkgsBuildHost # configurePhase: , gnChromium +, symlinkJoin # Build inputs: , libpng @@ -360,6 +361,14 @@ let ${ungoogler}/utils/domain_substitution.py apply -r ${ungoogler}/domain_regex.list -f ${ungoogler}/domain_substitution.list -c ./ungoogled-domsubcache.tar.gz . ''; + llvmCcAndBintools = symlinkJoin { + name = "llvmCcAndBintools"; + paths = [ + pkgsBuildTarget.${llvmPackages_attrName}.llvm + pkgsBuildTarget.${llvmPackages_attrName}.stdenv.cc + ]; + }; + gnFlags = mkGnFlags ({ # Main build and toolchain settings: # Create an official and optimized release build (only official builds @@ -426,7 +435,7 @@ let rtc_use_pipewire = true; # Disable PGO because the profile data requires a newer compiler version (LLVM 14 isn't sufficient): chrome_pgo_phase = 0; - clang_base_path = "${pkgsBuildTarget.${llvmPackages_attrName}.stdenv.cc}"; + clang_base_path = "${llvmCcAndBintools}"; use_qt = false; # To fix the build as we don't provide libffi_pic.a # (ld.lld: error: unable to find library -l:libffi_pic.a): From 8df62b078d46adec7da4daf8ab6b4132082283a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 8 May 2024 10:35:18 +0000 Subject: [PATCH 3/3] python3.pkgs.dbus-python: fix cross build --- pkgs/development/python-modules/dbus-python/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/python-modules/dbus-python/default.nix b/pkgs/development/python-modules/dbus-python/default.nix index 4e6f67f0a8ec..9b7656993c59 100644 --- a/pkgs/development/python-modules/dbus-python/default.nix +++ b/pkgs/development/python-modules/dbus-python/default.nix @@ -52,6 +52,7 @@ buildPythonPackage rec { ''; nativeBuildInputs = [ + dbus # build systems checks for `dbus-run-session` in PATH meson meson-python pkg-config