chore(third_party/crate2nix): apply patches to fix cross
Together with temporarily pointing nixpkgs past b10994c38c61038970a19fa60bfbec21a61755cc, this now fixes cross- compilation for tvix. This incorporates the changes proposed in https://cl.tvl.fyi/9888 and https://cl.tvl.fyi/9889, but by fixing it in crate2nix, and using the (re-)generated version of it. Changes were sent upstream at https://github.com/nix-community/crate2nix/pull/309, this pulls in a minimal patch for now. Change-Id: I70bb6f003bbc3e89de9c4eb4985ea4708ac3a9fd Reviewed-on: https://cl.tvl.fyi/c/depot/+/9890 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
This commit is contained in:
parent
5a0ae8312c
commit
ceca00a866
4 changed files with 70 additions and 6 deletions
33
third_party/overlays/patches/crate2nix-skip-running-tests-when-cross-compiling.patch
vendored
Normal file
33
third_party/overlays/patches/crate2nix-skip-running-tests-when-cross-compiling.patch
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
From b37dff98b7df177313f2823a77c19828398f1505 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Klink <flokli@flokli.de>
|
||||
Date: Tue, 31 Oct 2023 14:18:06 +0200
|
||||
Subject: [PATCH] skip running tests when cross-compiling
|
||||
|
||||
---
|
||||
crate2nix/templates/nix/crate2nix/default.nix | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/crate2nix/templates/nix/crate2nix/default.nix b/crate2nix/templates/nix/crate2nix/default.nix
|
||||
index 2b8050c..e4fc2e9 100644
|
||||
--- a/templates/nix/crate2nix/default.nix
|
||||
+++ b/templates/nix/crate2nix/default.nix
|
||||
@@ -165,10 +165,12 @@ rec {
|
||||
passthru = (crate.passthru or { }) // {
|
||||
inherit test;
|
||||
};
|
||||
- } ''
|
||||
- echo tested by ${test}
|
||||
- ${lib.concatMapStringsSep "\n" (output: "ln -s ${crate.${output}} ${"$"}${output}") crate.outputs}
|
||||
- '';
|
||||
+ }
|
||||
+ (lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
+ echo tested by ${test}
|
||||
+ '' + ''
|
||||
+ ${lib.concatMapStringsSep "\n" (output: "ln -s ${crate.${output}} ${"$"}${output}") crate.outputs}
|
||||
+ '');
|
||||
|
||||
/* A restricted overridable version of builtRustCratesWithFeatures. */
|
||||
buildRustCrateWithFeatures =
|
||||
--
|
||||
2.42.0
|
||||
|
26
third_party/overlays/patches/crate2nix-take-lndir-from-buildPackages.patch
vendored
Normal file
26
third_party/overlays/patches/crate2nix-take-lndir-from-buildPackages.patch
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
From ea4ec75c6cae0c0aba21c3cf4616dfceb64bff7a Mon Sep 17 00:00:00 2001
|
||||
From: Florian Klink <flokli@flokli.de>
|
||||
Date: Tue, 31 Oct 2023 14:16:22 +0200
|
||||
Subject: [PATCH 1/2] take lndir from buildPackages
|
||||
|
||||
This needs to be executed on the building host.
|
||||
---
|
||||
crate2nix/templates/nix/crate2nix/default.nix | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/crate2nix/templates/nix/crate2nix/default.nix b/crate2nix/templates/nix/crate2nix/default.nix
|
||||
index 1b859fb..2b8050c 100644
|
||||
--- a/templates/nix/crate2nix/default.nix
|
||||
+++ b/templates/nix/crate2nix/default.nix
|
||||
@@ -135,7 +135,7 @@ rec {
|
||||
# recreate a file hierarchy as when running tests with cargo
|
||||
|
||||
# the source for test data
|
||||
- ${pkgs.xorg.lndir}/bin/lndir ${crate.src}
|
||||
+ ${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src}
|
||||
|
||||
# build outputs
|
||||
testRoot=target/debug
|
||||
--
|
||||
2.42.0
|
||||
|
5
third_party/overlays/tvl.nix
vendored
5
third_party/overlays/tvl.nix
vendored
|
@ -108,12 +108,15 @@ depot.nix.readTree.drvTargets {
|
|||
};
|
||||
}));
|
||||
|
||||
# Apply a patch to run tests in debug, not release mode.
|
||||
crate2nix = super.crate2nix.overrideAttrs (old: rec {
|
||||
patches = old.patches ++ [
|
||||
# run tests in debug mode, not release mode
|
||||
# https://github.com/nix-community/crate2nix/pull/301
|
||||
./patches/crate2nix-tests-debug.patch
|
||||
|
||||
# https://github.com/nix-community/crate2nix/pull/309
|
||||
./patches/crate2nix-take-lndir-from-buildPackages.patch
|
||||
./patches/crate2nix-skip-running-tests-when-cross-compiling.patch
|
||||
];
|
||||
});
|
||||
|
||||
|
|
|
@ -11413,7 +11413,7 @@ rec {
|
|||
# recreate a file hierarchy as when running tests with cargo
|
||||
|
||||
# the source for test data
|
||||
${pkgs.xorg.lndir}/bin/lndir ${crate.src}
|
||||
${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src}
|
||||
|
||||
# build outputs
|
||||
testRoot=target/debug
|
||||
|
@ -11443,10 +11443,12 @@ rec {
|
|||
passthru = (crate.passthru or { }) // {
|
||||
inherit test;
|
||||
};
|
||||
} ''
|
||||
echo tested by ${test}
|
||||
${lib.concatMapStringsSep "\n" (output: "ln -s ${crate.${output}} ${"$"}${output}") crate.outputs}
|
||||
'';
|
||||
}
|
||||
(lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
echo tested by ${test}
|
||||
'' + ''
|
||||
${lib.concatMapStringsSep "\n" (output: "ln -s ${crate.${output}} ${"$"}${output}") crate.outputs}
|
||||
'');
|
||||
|
||||
/* A restricted overridable version of builtRustCratesWithFeatures. */
|
||||
buildRustCrateWithFeatures =
|
||||
|
|
Loading…
Reference in a new issue