3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/build-support/vm/windows/cygwin-iso/default.nix
Michael Raskin 5f3fa24a20 cygwin-iso: fix the most obvious parts of bit rot
Still doesn't build though. Is anyone still using it?
2017-02-09 15:07:38 +01:00

58 lines
1.5 KiB
Nix

{ stdenv, fetchurl, runCommand, python, perl, xorriso, pathsFromGraph
, arch ? "x86_64"
}:
{ packages ? []
, mirror ? "http://ftp.gwdg.de/pub/linux/sources.redhat.com/cygwin"
, extraContents ? []
}:
let
cygPkgList = if arch == "x86_64" then fetchurl {
url = "${mirror}/x86_64/setup.ini";
sha256 = "0arrxvxbl85l82iy648snx5cl952w791p45p0dfg1xpiaf96cbkj";
} else fetchurl {
url = "${mirror}/x86/setup.ini";
sha256 = "1fayx34868vd5h2nah7chiw65sl3i9qzrwvs7lrlv2h8k412vb69";
};
cygwinCross = (import ../../../../.. {
inherit (stdenv) system;
crossSystem = {
libc = "msvcrt";
platform = {};
openssl.system = "mingw64";
inherit arch;
config = "${arch}-w64-mingw32";
};
}).windows.cygwinSetup;
makeCygwinClosure = { packages, packageList }: let
expr = import (runCommand "cygwin.nix" { buildInputs = [ python ]; } ''
python ${./mkclosure.py} "${packages}" ${toString packageList} > "$out"
'');
gen = { url, hash }: {
source = fetchurl {
url = "${mirror}/${url}";
sha512 = hash;
};
target = url;
};
in map gen expr;
in import ../../../../../nixos/lib/make-iso9660-image.nix {
inherit stdenv perl xorriso pathsFromGraph;
syslinux = null;
contents = [
{ source = "${cygwinCross}/bin/setup.exe";
target = "setup.exe";
}
{ source = cygPkgList;
target = "setup.ini";
}
] ++ makeCygwinClosure {
packages = cygPkgList;
packageList = packages;
} ++ extraContents;
}