Fix i386 build with custom toolchain (armv6 unknown state)

This commit is contained in:
Alex Auvolat 2022-10-14 15:45:37 +02:00
parent 8d04ae7014
commit e89e047c5a
No known key found for this signature in database
GPG key ID: 0E496D15096376BE
4 changed files with 34 additions and 37 deletions

View file

@ -43,10 +43,13 @@ in {
target = "x86_64-unknown-linux-musl"; target = "x86_64-unknown-linux-musl";
features = [ features = [
"garage/bundled-libs" "garage/bundled-libs"
"garage/sled"
"garage/k2v" "garage/k2v"
"garage/sled"
"garage/lmdb" "garage/lmdb"
"garage/sqlite" "garage/sqlite"
"garage_db/sled"
"garage_db/lmdb"
"garage_db/sqlite"
]; ];
}); });
}; };

View file

@ -8,12 +8,12 @@ rec {
#sha256 = "1xy9zpypqfxs5gcq5dcla4bfkhxmh5nzn9dyqkr03lqycm9wg5cr"; #sha256 = "1xy9zpypqfxs5gcq5dcla4bfkhxmh5nzn9dyqkr03lqycm9wg5cr";
# NixOS 22.05 # NixOS 22.05
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/22.05.zip"; #url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/22.05.zip";
sha256 = "0d643wp3l77hv2pmg2fi7vyxn4rwy0iyr8djcw1h5x72315ck9ik"; #sha256 = "0d643wp3l77hv2pmg2fi7vyxn4rwy0iyr8djcw1h5x72315ck9ik";
# As of 2022-10-13 # As of 2022-10-13
#url = "https://github.com/NixOS/nixpkgs/archive/a3073c49bc0163fea6a121c276f526837672b555.zip"; url = "https://github.com/NixOS/nixpkgs/archive/a3073c49bc0163fea6a121c276f526837672b555.zip";
#sha256 = "1bz632psfbpmicyzjb8b4265y50shylccvfm6ry6mgnv5hvz324s"; sha256 = "1bz632psfbpmicyzjb8b4265y50shylccvfm6ry6mgnv5hvz324s";
}; };
cargo2nixSrc = fetchGit { cargo2nixSrc = fetchGit {
# As of 2022-10-14: (TODO) # As of 2022-10-14: (TODO)

View file

@ -13,9 +13,10 @@ let
log = v: builtins.trace v v; log = v: builtins.trace v v;
pkgs = import pkgsSrc { pkgs = import pkgsSrc {
inherit system; inherit system;
crossSystem = { crossSystem = {
config = target; config = target;
isStatic = true;
}; };
overlays = [ cargo2nixOverlay ]; overlays = [ cargo2nixOverlay ];
}; };
@ -30,26 +31,22 @@ let
we emulate the structure of the Rust object created by rustOverlay. we emulate the structure of the Rust object created by rustOverlay.
In practise, rustOverlay ships rustc+cargo in a single derivation while In practise, rustOverlay ships rustc+cargo in a single derivation while
NixOS ships them in separate ones. We reunite them with symlinkJoin. 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: { buildEnv = (drv: {
rustc = drv.setBuildEnv; rustc = drv.setBuildEnv;
@ -57,7 +54,7 @@ let
${drv.setBuildEnv or "" } ${drv.setBuildEnv or "" }
echo echo
echo --- BUILDING WITH CLIPPY --- echo --- BUILDING WITH CLIPPY ---
echo echo
export NIX_RUST_BUILD_FLAGS="''${NIX_RUST_BUILD_FLAGS} --deny warnings" export NIX_RUST_BUILD_FLAGS="''${NIX_RUST_BUILD_FLAGS} --deny warnings"
export RUSTC="''${CLIPPY_DRIVER}" export RUSTC="''${CLIPPY_DRIVER}"
@ -215,12 +212,7 @@ let
else target; else target;
in in
pkgs.rustBuilder.makePackageSet { pkgs.rustBuilder.makePackageSet ({
inherit release packageFun packageOverrides codegenOpts rootFeatures; inherit release packageFun packageOverrides codegenOpts rootFeatures;
#inherit rustToolchain;
rustVersion = "1.63.0";
target = rustTarget; target = rustTarget;
extraRustComponents = [ "clippy" ]; } // toolchainOptions)
}

View file

@ -6,14 +6,17 @@ with import ./common.nix;
let let
platforms = [ platforms = [
"x86_64-unknown-linux-musl" #"x86_64-unknown-linux-musl"
"i686-unknown-linux-musl" "i686-unknown-linux-musl"
"aarch64-unknown-linux-musl" #"aarch64-unknown-linux-musl"
"armv6l-unknown-linux-musleabihf" "armv6l-unknown-linux-musleabihf"
]; ];
pkgsList = builtins.map (target: import pkgsSrc { pkgsList = builtins.map (target: import pkgsSrc {
inherit system; inherit system;
crossSystem = { config = target; }; crossSystem = {
config = target;
isStatic = true;
};
overlays = [ cargo2nixOverlay ]; overlays = [ cargo2nixOverlay ];
}) platforms; }) platforms;
pkgsHost = import pkgsSrc {}; pkgsHost = import pkgsSrc {};
@ -25,7 +28,6 @@ in
lib.flatten (builtins.map (pkgs: [ lib.flatten (builtins.map (pkgs: [
pkgs.rustPlatform.rust.rustc pkgs.rustPlatform.rust.rustc
pkgs.rustPlatform.rust.cargo pkgs.rustPlatform.rust.cargo
pkgs.clippy
pkgs.buildPackages.stdenv.cc pkgs.buildPackages.stdenv.cc
]) pkgsList) ++ [ ]) pkgsList) ++ [
kaniko kaniko