fix cross-compiled builds

This commit is contained in:
Alex 2025-02-02 21:57:21 +01:00
parent 63aef19bbb
commit c4ba50a94a
2 changed files with 13 additions and 12 deletions

View file

@ -1,4 +1,4 @@
{ system ? builtins.currentSystem, git_version ? "unknown", }: { system ? builtins.currentSystem, git_version ? null, }:
with import ./nix/common.nix; with import ./nix/common.nix;

View file

@ -29,6 +29,11 @@ let
"arm-unknown-linux-musleabihf" = "ARM_UNKNOWN_LINUX_MUSLEABIHF"; "arm-unknown-linux-musleabihf" = "ARM_UNKNOWN_LINUX_MUSLEABIHF";
}; };
pkgsNative = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
pkgs = if target != null then pkgs = if target != null then
import nixpkgs { import nixpkgs {
inherit system; inherit system;
@ -39,10 +44,7 @@ let
overlays = [ (import rust-overlay) ]; overlays = [ (import rust-overlay) ];
} }
else else
import nixpkgs { pkgsNative;
inherit system;
overlays = [ (import rust-overlay) ];
};
inherit (pkgs) lib stdenv; inherit (pkgs) lib stdenv;
@ -115,14 +117,13 @@ let
strictDeps = true; strictDeps = true;
cargoExtraArgs = "--locked --features ${featuresStr}"; cargoExtraArgs = "--locked --features ${featuresStr}";
nativeBuildInputs = with pkgs; ([ nativeBuildInputs = [
pkg-config pkgsNative.protobuf
stdenv.cc pkgs.stdenv.cc
protobuf
] ++ lib.optionals (target == null) [ ] ++ lib.optionals (target == null) [
clang pkgs.clang
mold pkgs.mold
]); ];
CARGO_PROFILE = if release then "release" else "dev"; CARGO_PROFILE = if release then "release" else "dev";
CARGO_BUILD_RUSTFLAGS = CARGO_BUILD_RUSTFLAGS =