1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-01 18:12:46 +00:00
nixpkgs/pkgs/build-support/vm/windows/cygwin-iso/default.nix

58 lines
1.5 KiB
Nix
Raw Normal View History

{ 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;
}