vm/windows: Allow to specify a different arch.

So far, we determined this based on stdenv.is64bit, but there are cases
where you want to run/build a 32bit program on a 64 bit Windows.

This is now possible, by passing windowsImage.arch = "i686" | "x86_64"
to runInWindowsVM. Based an what was passed, the corresponding Cygwin
packages and setup.exe are bootstrapped.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-03-04 08:13:22 +01:00
parent c4d5757e29
commit bd2d120c08
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961
2 changed files with 11 additions and 10 deletions

View File

@ -3,7 +3,7 @@
, samba, socat, vde2, cdrkit, pathsFromGraph
}:
{ isoFile, productKey }:
{ isoFile, productKey, arch ? null }:
with stdenv.lib;
@ -15,6 +15,9 @@ let
mkCygwinImage = import ./cygwin-iso {
inherit stdenv fetchurl runCommand python perl cdrkit pathsFromGraph;
arch = let
defaultArch = if stdenv.is64bit then "x86_64" else "i686";
in if arch == null then defaultArch else arch;
};
installer = import ./install {

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, runCommand, python, perl, cdrkit, pathsFromGraph }:
{ stdenv, fetchurl, runCommand, python, perl, cdrkit, pathsFromGraph
, arch ? "x86_64"
}:
{ packages ? []
, mirror ? "http://ftp.gwdg.de/pub/linux/sources.redhat.com/cygwin"
@ -6,7 +8,7 @@
}:
let
cygPkgList = if stdenv.is64bit then fetchurl {
cygPkgList = if arch == "x86_64" then fetchurl {
url = "${mirror}/x86_64/setup.ini";
sha256 = "0ljsxdkx9s916wp28kcvql3bjx80zzzidan6jicby7i9s3sm96n9";
} else fetchurl {
@ -20,13 +22,9 @@ let
libc = "msvcrt";
platform = {};
openssl.system = "mingw64";
} // (if stdenv.is64bit then {
config = "x86_64-w64-mingw32";
arch = "x86_64";
} else {
config = "i686-w64-mingw32";
arch = "i686";
});
inherit arch;
config = "${arch}-w64-mingw32";
};
}).windows.cygwinSetup.crossDrv;
makeCygwinClosure = { packages, packageList }: let