2017-02-09 14:06:49 +00:00
|
|
|
{ stdenv, fetchurl, runCommand, python, perl, xorriso, pathsFromGraph
|
2014-03-04 07:13:22 +00:00
|
|
|
, arch ? "x86_64"
|
|
|
|
}:
|
2014-02-26 04:43:34 +00:00
|
|
|
|
2014-02-15 17:17:21 +00:00
|
|
|
{ packages ? []
|
|
|
|
, mirror ? "http://ftp.gwdg.de/pub/linux/sources.redhat.com/cygwin"
|
|
|
|
, extraContents ? []
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2014-03-04 07:13:22 +00:00
|
|
|
cygPkgList = if arch == "x86_64" then fetchurl {
|
2014-02-15 17:17:21 +00:00
|
|
|
url = "${mirror}/x86_64/setup.ini";
|
2017-02-09 14:06:49 +00:00
|
|
|
sha256 = "0arrxvxbl85l82iy648snx5cl952w791p45p0dfg1xpiaf96cbkj";
|
2014-02-26 05:19:05 +00:00
|
|
|
} else fetchurl {
|
|
|
|
url = "${mirror}/x86/setup.ini";
|
2017-02-09 14:06:49 +00:00
|
|
|
sha256 = "1fayx34868vd5h2nah7chiw65sl3i9qzrwvs7lrlv2h8k412vb69";
|
2014-02-15 17:17:21 +00:00
|
|
|
};
|
|
|
|
|
2016-03-13 18:24:55 +00:00
|
|
|
cygwinCross = (import ../../../../.. {
|
2014-03-03 22:21:34 +00:00
|
|
|
inherit (stdenv) system;
|
|
|
|
crossSystem = {
|
|
|
|
libc = "msvcrt";
|
|
|
|
platform = {};
|
|
|
|
openssl.system = "mingw64";
|
2014-03-04 07:13:22 +00:00
|
|
|
inherit arch;
|
|
|
|
config = "${arch}-w64-mingw32";
|
|
|
|
};
|
2017-02-09 14:06:49 +00:00
|
|
|
}).windows.cygwinSetup;
|
2014-03-03 22:21:34 +00:00
|
|
|
|
2014-02-15 17:17:21 +00:00
|
|
|
makeCygwinClosure = { packages, packageList }: let
|
|
|
|
expr = import (runCommand "cygwin.nix" { buildInputs = [ python ]; } ''
|
|
|
|
python ${./mkclosure.py} "${packages}" ${toString packageList} > "$out"
|
|
|
|
'');
|
2017-02-09 14:06:49 +00:00
|
|
|
gen = { url, hash }: {
|
2014-02-15 17:17:21 +00:00
|
|
|
source = fetchurl {
|
|
|
|
url = "${mirror}/${url}";
|
2017-02-09 14:06:49 +00:00
|
|
|
sha512 = hash;
|
2014-02-15 17:17:21 +00:00
|
|
|
};
|
|
|
|
target = url;
|
|
|
|
};
|
|
|
|
in map gen expr;
|
|
|
|
|
2014-09-23 14:48:15 +01:00
|
|
|
in import ../../../../../nixos/lib/make-iso9660-image.nix {
|
2017-02-09 14:06:49 +00:00
|
|
|
inherit stdenv perl xorriso pathsFromGraph;
|
|
|
|
syslinux = null;
|
2014-02-15 17:17:21 +00:00
|
|
|
contents = [
|
2014-03-03 22:21:34 +00:00
|
|
|
{ source = "${cygwinCross}/bin/setup.exe";
|
2014-02-15 17:17:21 +00:00
|
|
|
target = "setup.exe";
|
|
|
|
}
|
|
|
|
{ source = cygPkgList;
|
|
|
|
target = "setup.ini";
|
|
|
|
}
|
|
|
|
] ++ makeCygwinClosure {
|
|
|
|
packages = cygPkgList;
|
|
|
|
packageList = packages;
|
|
|
|
} ++ extraContents;
|
|
|
|
}
|