about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-05-09 13:43:23 +0000
committerAlyssa Ross <hi@alyssa.is>2023-11-09 10:02:24 +0100
commit506dcaabb4e004ed5db214f7efbbc278e89f6212 (patch)
tree598008dc703c9bb99df9bfe8311a926e1a900603 /pkgs
parente3e57b8f1885bf1dc4787728479711f46a4171cc (diff)
stdenv: fix meson rust cross compilation
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/desktops/gnome/core/gnome-tour/default.nix11
-rw-r--r--pkgs/development/libraries/gstreamer/rs/default.nix10
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix2
3 files changed, 3 insertions, 20 deletions
diff --git a/pkgs/desktops/gnome/core/gnome-tour/default.nix b/pkgs/desktops/gnome/core/gnome-tour/default.nix
index 26ac73f546d5c..bb658fcd4489f 100644
--- a/pkgs/desktops/gnome/core/gnome-tour/default.nix
+++ b/pkgs/desktops/gnome/core/gnome-tour/default.nix
@@ -17,7 +17,6 @@
 , libadwaita
 , librsvg
 , rustc
-, writeText
 , cargo
 }:
 
@@ -59,16 +58,6 @@ stdenv.mkDerivation rec {
     librsvg
   ];
 
-  mesonFlags =
-    let
-      # ERROR: 'rust' compiler binary not defined in cross or native file
-      crossFile = writeText "cross-file.conf" ''
-        [binaries]
-        rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
-      '';
-    in
-    lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];
-
   passthru = {
     updateScript = gnome.updateScript {
       packageName = pname;
diff --git a/pkgs/development/libraries/gstreamer/rs/default.nix b/pkgs/development/libraries/gstreamer/rs/default.nix
index 1d06f88095971..ee467f965c817 100644
--- a/pkgs/development/libraries/gstreamer/rs/default.nix
+++ b/pkgs/development/libraries/gstreamer/rs/default.nix
@@ -2,7 +2,6 @@
 , stdenv
 , fetchFromGitLab
 , fetchpatch
-, writeText
 , rustPlatform
 , meson
 , ninja
@@ -204,14 +203,7 @@ stdenv.mkDerivation rec {
   ) ++ [
     (lib.mesonOption "sodium-source" "system")
     (lib.mesonEnable "doc" enableDocumentation)
-  ] ++ (let
-    crossFile = writeText "cross-file.conf" ''
-      [binaries]
-      rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
-    '';
-  in lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
-    "--cross-file=${crossFile}"
-  ]);
+  ];
 
   # turn off all auto plugins since we use a list of plugins we generate
   mesonAutoFeatures = "disabled";
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index d235ffefaab40..bd0d85fc676a3 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -402,6 +402,7 @@ else let
 
           crossFile = builtins.toFile "cross-file.conf" ''
             [properties]
+            bindgen_clang_arguments = ['-target', '${stdenv.targetPlatform.config}']
             needs_exe_wrapper = ${lib.boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)}
 
             [host_machine]
@@ -412,6 +413,7 @@ else let
 
             [binaries]
             llvm-config = 'llvm-config-native'
+            rust = ['rustc', '--target', '${stdenv.targetPlatform.rust.rustcTargetSpec}']
           '';
           crossFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];
         in crossFlags ++ mesonFlags;