Windows pure shell build works
This commit is contained in:
parent
f6b1f1fc23
commit
e46bcfda3f
27
default.nix
27
default.nix
@ -12,9 +12,10 @@ let
|
||||
newBuildTarget = {
|
||||
nixPkgsSystem,
|
||||
rustTarget ? nixPkgsSystem,
|
||||
depsBuildBuild ? pkgsCross: [],
|
||||
nativeBuildInputs ? pkgsCross: [],
|
||||
rustFlags ? pkgsCross: [],
|
||||
}: {
|
||||
inherit nixPkgsSystem rustTarget depsBuildBuild;
|
||||
inherit nixPkgsSystem rustTarget nativeBuildInputs rustFlags;
|
||||
};
|
||||
|
||||
# centralize per-target configuration in a single place.
|
||||
@ -40,10 +41,10 @@ let
|
||||
"x86_64-windows" = newBuildTarget {
|
||||
nixPkgsSystem = "x86_64-w64-mingw32";
|
||||
rustTarget = "x86_64-pc-windows-gnu";
|
||||
#depsBuildBuild = pkgsCross: [
|
||||
# pkgsCross.stdenv.cc
|
||||
# pkgsCross.windows.pthreads
|
||||
#];
|
||||
nativeBuildInputs = pkgsCross: [ pkgsCross.windows.pthreads ];
|
||||
rustFlags = pkgsCross: [
|
||||
"-C" "link-arg=-L${pkgsCross.windows.pthreads}/lib"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@ -143,11 +144,13 @@ let
|
||||
'';
|
||||
|
||||
buildEnv = rec {
|
||||
nativeBuildInputs = (buildTarget.depsBuildBuild pkgsCross) ++ [
|
||||
nativeBuildInputs = (buildTarget.nativeBuildInputs pkgsCross) ++ [
|
||||
toolchain
|
||||
pkgs.protobuf
|
||||
#pkgsCross.stdenv.cc
|
||||
#pkgsCross.windows.pthreads
|
||||
|
||||
# Required for shell because of rust dependency build scripts which must
|
||||
# run on the build system.
|
||||
pkgs.stdenv.cc
|
||||
];
|
||||
|
||||
SODIUM_LIB_DIR = "${libsodium}/lib";
|
||||
@ -159,11 +162,11 @@ let
|
||||
CARGO_BUILD_TARGET = rustTarget;
|
||||
CARGO_BUILD_RUSTFLAGS = [
|
||||
"-C" "target-feature=+crt-static"
|
||||
"-C" "link-args=-static"
|
||||
"-C" "link-arg=-static"
|
||||
|
||||
# https://github.com/rust-lang/cargo/issues/4133
|
||||
"-C" "linker=${TARGET_CC}"
|
||||
];
|
||||
] ++ (buildTarget.rustFlags pkgsCross);
|
||||
};
|
||||
|
||||
in {
|
||||
@ -182,7 +185,7 @@ in {
|
||||
];
|
||||
} // buildEnv);
|
||||
|
||||
shell = pkgs.mkShell buildEnv;
|
||||
shell = pkgsCross.mkShell buildEnv;
|
||||
|
||||
# TODO
|
||||
#clippy = {
|
||||
|
Loading…
Reference in New Issue
Block a user