prepare for windows impl

This commit is contained in:
Robin Appelman 2023-05-17 22:55:01 +02:00
commit d12b70d11e
16 changed files with 550 additions and 279 deletions

View file

@ -1,7 +1,10 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
@ -9,9 +12,24 @@
nixpkgs,
utils,
naersk,
rust-overlay,
}:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
pkgs-cross-mingw = import nixpkgs {
crossSystem = {
config = "x86_64-w64-mingw32";
};
inherit system overlays;
};
mingw_w64_cc = pkgs-cross-mingw.stdenv.cc;
mingw_w64 = pkgs-cross-mingw.windows.mingw_w64;
windows = pkgs-cross-mingw.windows;
naersk-lib = naersk.lib."${system}";
in rec {
# `nix build`
@ -34,7 +52,18 @@
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [cargo bacon];
nativeBuildInputs = with pkgs; [
(rust-bin.stable.latest.default.override {
targets = [ "x86_64-pc-windows-gnu" ];
})
bacon
mingw_w64_cc
];
depsBuildBuild = [ pkgs.wine64 ];
# buildInputs = [ windows.pthreads ];
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = "${mingw_w64_cc.targetPrefix}cc";
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER = "wine64";
};
})
// {