tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
stdenv: fix meson rust cross compilation
Alyssa Ross
2 years ago
506dcaab
e3e57b8f
+3
-20
3 changed files
expand all
collapse all
unified
split
pkgs
desktops
gnome
core
gnome-tour
default.nix
development
libraries
gstreamer
rs
default.nix
stdenv
generic
make-derivation.nix
-11
pkgs/desktops/gnome/core/gnome-tour/default.nix
···
17
17
, libadwaita
18
18
, librsvg
19
19
, rustc
20
20
-
, writeText
21
20
, cargo
22
21
}:
23
22
···
58
57
libadwaita
59
58
librsvg
60
59
];
61
61
-
62
62
-
mesonFlags =
63
63
-
let
64
64
-
# ERROR: 'rust' compiler binary not defined in cross or native file
65
65
-
crossFile = writeText "cross-file.conf" ''
66
66
-
[binaries]
67
67
-
rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
68
68
-
'';
69
69
-
in
70
70
-
lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];
71
60
72
61
passthru = {
73
62
updateScript = gnome.updateScript {
+1
-9
pkgs/development/libraries/gstreamer/rs/default.nix
···
2
2
, stdenv
3
3
, fetchFromGitLab
4
4
, fetchpatch
5
5
-
, writeText
6
5
, rustPlatform
7
6
, meson
8
7
, ninja
···
204
203
) ++ [
205
204
(lib.mesonOption "sodium-source" "system")
206
205
(lib.mesonEnable "doc" enableDocumentation)
207
207
-
] ++ (let
208
208
-
crossFile = writeText "cross-file.conf" ''
209
209
-
[binaries]
210
210
-
rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
211
211
-
'';
212
212
-
in lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
213
213
-
"--cross-file=${crossFile}"
214
214
-
]);
206
206
+
];
215
207
216
208
# turn off all auto plugins since we use a list of plugins we generate
217
209
mesonAutoFeatures = "disabled";
+2
pkgs/stdenv/generic/make-derivation.nix
···
402
402
403
403
crossFile = builtins.toFile "cross-file.conf" ''
404
404
[properties]
405
405
+
bindgen_clang_arguments = ['-target', '${stdenv.targetPlatform.config}']
405
406
needs_exe_wrapper = ${lib.boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)}
406
407
407
408
[host_machine]
···
412
413
413
414
[binaries]
414
415
llvm-config = 'llvm-config-native'
416
416
+
rust = ['rustc', '--target', '${stdenv.targetPlatform.rust.rustcTargetSpec}']
415
417
'';
416
418
crossFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];
417
419
in crossFlags ++ mesonFlags;