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;

View file

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