2014-02-26 05:43:34 +01:00
|
|
|
{ stdenv, fetchurl, runCommand, python, perl, cdrkit, pathsFromGraph }:
|
|
|
|
|
2014-02-15 18:17:21 +01:00
|
|
|
{ packages ? []
|
|
|
|
, mirror ? "http://ftp.gwdg.de/pub/linux/sources.redhat.com/cygwin"
|
|
|
|
, extraContents ? []
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2014-02-26 06:19:05 +01:00
|
|
|
cygPkgList = if stdenv.is64bit then fetchurl {
|
2014-02-15 18:17:21 +01:00
|
|
|
url = "${mirror}/x86_64/setup.ini";
|
2014-02-26 06:19:05 +01:00
|
|
|
sha256 = "142f8zyfwgi6s2djxv3z5wn0ysl94pxwa79z8rjfqz4kvnpgz120";
|
|
|
|
} else fetchurl {
|
|
|
|
url = "${mirror}/x86/setup.ini";
|
|
|
|
sha256 = "1v596lln2iip5h7wxjnig5rflzvqa21zzd2iyhx07zs28q5h76i9";
|
2014-02-15 18:17:21 +01:00
|
|
|
};
|
|
|
|
|
2014-03-03 23:21:34 +01:00
|
|
|
cygwinCross = (import ../../../../top-level/all-packages.nix {
|
|
|
|
inherit (stdenv) system;
|
|
|
|
crossSystem = {
|
|
|
|
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";
|
|
|
|
});
|
|
|
|
}).windows.cygwinSetup.crossDrv;
|
|
|
|
|
2014-02-15 18:17:21 +01:00
|
|
|
makeCygwinClosure = { packages, packageList }: let
|
|
|
|
expr = import (runCommand "cygwin.nix" { buildInputs = [ python ]; } ''
|
|
|
|
python ${./mkclosure.py} "${packages}" ${toString packageList} > "$out"
|
|
|
|
'');
|
|
|
|
gen = { url, md5 }: {
|
|
|
|
source = fetchurl {
|
|
|
|
url = "${mirror}/${url}";
|
|
|
|
inherit md5;
|
|
|
|
};
|
|
|
|
target = url;
|
|
|
|
};
|
|
|
|
in map gen expr;
|
|
|
|
|
|
|
|
in import <nixpkgs/nixos/lib/make-iso9660-image.nix> {
|
2014-03-03 22:45:14 +01:00
|
|
|
inherit stdenv perl cdrkit pathsFromGraph;
|
2014-02-15 18:17:21 +01:00
|
|
|
contents = [
|
2014-03-03 23:21:34 +01:00
|
|
|
{ source = "${cygwinCross}/bin/setup.exe";
|
2014-02-15 18:17:21 +01:00
|
|
|
target = "setup.exe";
|
|
|
|
}
|
|
|
|
{ source = cygPkgList;
|
|
|
|
target = "setup.ini";
|
|
|
|
}
|
|
|
|
] ++ makeCygwinClosure {
|
|
|
|
packages = cygPkgList;
|
|
|
|
packageList = packages;
|
|
|
|
} ++ extraContents;
|
|
|
|
}
|