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 = {
|
newBuildTarget = {
|
||||||
nixPkgsSystem,
|
nixPkgsSystem,
|
||||||
rustTarget ? 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.
|
# centralize per-target configuration in a single place.
|
||||||
@ -40,10 +41,10 @@ let
|
|||||||
"x86_64-windows" = newBuildTarget {
|
"x86_64-windows" = newBuildTarget {
|
||||||
nixPkgsSystem = "x86_64-w64-mingw32";
|
nixPkgsSystem = "x86_64-w64-mingw32";
|
||||||
rustTarget = "x86_64-pc-windows-gnu";
|
rustTarget = "x86_64-pc-windows-gnu";
|
||||||
#depsBuildBuild = pkgsCross: [
|
nativeBuildInputs = pkgsCross: [ pkgsCross.windows.pthreads ];
|
||||||
# pkgsCross.stdenv.cc
|
rustFlags = pkgsCross: [
|
||||||
# pkgsCross.windows.pthreads
|
"-C" "link-arg=-L${pkgsCross.windows.pthreads}/lib"
|
||||||
#];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,11 +144,13 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
buildEnv = rec {
|
buildEnv = rec {
|
||||||
nativeBuildInputs = (buildTarget.depsBuildBuild pkgsCross) ++ [
|
nativeBuildInputs = (buildTarget.nativeBuildInputs pkgsCross) ++ [
|
||||||
toolchain
|
toolchain
|
||||||
pkgs.protobuf
|
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";
|
SODIUM_LIB_DIR = "${libsodium}/lib";
|
||||||
@ -159,11 +162,11 @@ let
|
|||||||
CARGO_BUILD_TARGET = rustTarget;
|
CARGO_BUILD_TARGET = rustTarget;
|
||||||
CARGO_BUILD_RUSTFLAGS = [
|
CARGO_BUILD_RUSTFLAGS = [
|
||||||
"-C" "target-feature=+crt-static"
|
"-C" "target-feature=+crt-static"
|
||||||
"-C" "link-args=-static"
|
"-C" "link-arg=-static"
|
||||||
|
|
||||||
# https://github.com/rust-lang/cargo/issues/4133
|
# https://github.com/rust-lang/cargo/issues/4133
|
||||||
"-C" "linker=${TARGET_CC}"
|
"-C" "linker=${TARGET_CC}"
|
||||||
];
|
] ++ (buildTarget.rustFlags pkgsCross);
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
@ -182,7 +185,7 @@ in {
|
|||||||
];
|
];
|
||||||
} // buildEnv);
|
} // buildEnv);
|
||||||
|
|
||||||
shell = pkgs.mkShell buildEnv;
|
shell = pkgsCross.mkShell buildEnv;
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
#clippy = {
|
#clippy = {
|
||||||
|
Loading…
Reference in New Issue
Block a user