Created
December 4, 2016 15:19
-
-
Save vcunat/88564cd00406a954aa671a2de93228a4 to your computer and use it in GitHub Desktop.
Linux->mingw cross-compiling shim: *-native is for packages not meant to be run on windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
lib = (import <nixpkgs> {}).lib; | |
pkgs-cross-xx = hostArch: | |
lib.mapAttrs | |
(name_: pkg: if lib.isDerivation pkg then pkg.crossDrv else pkg) | |
(pkgs-cross-xx-nocross hostArch); | |
pkgs-cross-xx-nocross = hostArch: | |
(import <nixpkgs> { | |
crossSystem = { | |
config = hostArch + "-w64-mingw32"; | |
arch = if hostArch == "i686" then "x86" else hostArch; # Irrelevant | |
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain | |
platform = {}; | |
openssl.system = "mingw" | |
+ lib.optionalString (hostArch == "x86_64") "64"; | |
}; | |
}); | |
in { | |
w32 = pkgs-cross-xx "i686"; | |
w64 = pkgs-cross-xx "x86_64"; | |
w32-native = pkgs-cross-xx-nocross "i686"; | |
w64-native = pkgs-cross-xx-nocross "x86_64"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment