aboutsummaryrefslogtreecommitdiff
path: root/nix/compile.nix
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-10-14 15:45:37 +0200
committerAlex Auvolat <alex@adnab.me>2022-10-14 18:10:24 +0200
commite89e047c5af33ac47dabbcfdc12305d544a13ade (patch)
tree411d204765054f4e57973facf20f4eea6c75d4c5 /nix/compile.nix
parent8d04ae7014991319e97d4280f0e9d7a70c89f10b (diff)
downloadgarage-e89e047c5af33ac47dabbcfdc12305d544a13ade.tar.gz
garage-e89e047c5af33ac47dabbcfdc12305d544a13ade.zip
Fix i386 build with custom toolchain (armv6 unknown state)
Diffstat (limited to 'nix/compile.nix')
-rw-r--r--nix/compile.nix48
1 files changed, 20 insertions, 28 deletions
diff --git a/nix/compile.nix b/nix/compile.nix
index 62eb956a..9406bb44 100644
--- a/nix/compile.nix
+++ b/nix/compile.nix
@@ -13,9 +13,10 @@ let
log = v: builtins.trace v v;
pkgs = import pkgsSrc {
- inherit system;
+ inherit system;
crossSystem = {
config = target;
+ isStatic = true;
};
overlays = [ cargo2nixOverlay ];
};
@@ -30,26 +31,22 @@ let
we emulate the structure of the Rust object created by rustOverlay.
In practise, rustOverlay ships rustc+cargo in a single derivation while
NixOS ships them in separate ones. We reunite them with symlinkJoin.
- */
- /*
- rustToolchain = {
- rustc = pkgs.symlinkJoin {
- name = "rust-channel";
- paths = [
- pkgs.rustPlatform.rust.cargo
- pkgs.rustPlatform.rust.rustc
- ];
- };
- clippy = pkgs.symlinkJoin {
- name = "clippy-channel";
- paths = [
- pkgs.rustPlatform.rust.cargo
- pkgs.rustPlatform.rust.rustc
- pkgs.clippy
- ];
- };
- }.${compiler};
*/
+ toolchainOptions =
+ if target == "x86_64-unknown-linux-musl" || target == "aarch64-unknown-linux-musl" then {
+ rustVersion = "1.63.0";
+ extraRustComponents = [ "clippy" ];
+ } else {
+ rustToolchain = pkgs.symlinkJoin {
+ name = "rust-static-toolchain-${target}";
+ paths = [
+ pkgs.rustPlatform.rust.cargo
+ pkgs.rustPlatform.rust.rustc
+ # clippy not needed, it only runs on amd64
+ ];
+ };
+ };
+
buildEnv = (drv: {
rustc = drv.setBuildEnv;
@@ -57,7 +54,7 @@ let
${drv.setBuildEnv or "" }
echo
echo --- BUILDING WITH CLIPPY ---
- echo
+ echo
export NIX_RUST_BUILD_FLAGS="''${NIX_RUST_BUILD_FLAGS} --deny warnings"
export RUSTC="''${CLIPPY_DRIVER}"
@@ -215,12 +212,7 @@ let
else target;
in
- pkgs.rustBuilder.makePackageSet {
+ pkgs.rustBuilder.makePackageSet ({
inherit release packageFun packageOverrides codegenOpts rootFeatures;
-
- #inherit rustToolchain;
- rustVersion = "1.63.0";
-
target = rustTarget;
- extraRustComponents = [ "clippy" ];
- }
+ } // toolchainOptions)