lol
1{ stdenv, writeText, dosfstools, mtools }:
2
3{ productKey
4, shExecAfterwards ? "E:\\bootstrap.sh"
5, cygwinRoot ? "C:\\cygwin"
6, cygwinSetup ? "E:\\setup.exe"
7, cygwinRepository ? "E:\\"
8, cygwinPackages ? [ "openssh" ]
9}:
10
11let
12 afterSetup = [
13 cygwinSetup
14 "-L -n -q"
15 "-l ${cygwinRepository}"
16 "-R ${cygwinRoot}"
17 "-C base"
18 ] ++ map (p: "-P ${p}") cygwinPackages;
19
20 winXpUnattended = writeText "winnt.sif" ''
21 [Data]
22 AutoPartition = 1
23 AutomaticUpdates = 0
24 MsDosInitiated = 0
25 UnattendedInstall = Yes
26
27 [Unattended]
28 DUDisable = Yes
29 DriverSigningPolicy = Ignore
30 Hibernation = No
31 OemPreinstall = No
32 OemSkipEula = Yes
33 Repartition = Yes
34 TargetPath = \WINDOWS
35 UnattendMode = FullUnattended
36 UnattendSwitch = Yes
37 WaitForReboot = No
38
39 [GuiUnattended]
40 AdminPassword = "nopasswd"
41 AutoLogon = Yes
42 AutoLogonCount = 1
43 OEMSkipRegional = 1
44 OemSkipWelcome = 1
45 ServerWelcome = No
46 TimeZone = 85
47
48 [UserData]
49 ComputerName = "cygwin"
50 FullName = "cygwin"
51 OrgName = ""
52 ProductKey = "${productKey}"
53
54 [Networking]
55 InstallDefaultComponents = Yes
56
57 [Identification]
58 JoinWorkgroup = cygwin
59
60 [NetAdapters]
61 PrimaryAdapter = params.PrimaryAdapter
62
63 [params.PrimaryAdapter]
64 InfID = *
65
66 [params.MS_MSClient]
67
68 [NetProtocols]
69 MS_TCPIP = params.MS_TCPIP
70
71 [params.MS_TCPIP]
72 AdapterSections=params.MS_TCPIP.PrimaryAdapter
73
74 [params.MS_TCPIP.PrimaryAdapter]
75 DHCP = No
76 IPAddress = 192.168.0.1
77 SpecificTo = PrimaryAdapter
78 SubnetMask = 255.255.255.0
79 WINS = No
80
81 ; Turn off all components
82 [Components]
83 ${stdenv.lib.concatMapStrings (comp: "${comp} = Off\n") [
84 "AccessOpt" "Appsrv_console" "Aspnet" "BitsServerExtensionsISAPI"
85 "BitsServerExtensionsManager" "Calc" "Certsrv" "Certsrv_client"
86 "Certsrv_server" "Charmap" "Chat" "Clipbook" "Cluster" "Complusnetwork"
87 "Deskpaper" "Dialer" "Dtcnetwork" "Fax" "Fp_extensions" "Fp_vdir_deploy"
88 "Freecell" "Hearts" "Hypertrm" "IEAccess" "IEHardenAdmin" "IEHardenUser"
89 "Iis_asp" "Iis_common" "Iis_ftp" "Iis_inetmgr" "Iis_internetdataconnector"
90 "Iis_nntp" "Iis_serversideincludes" "Iis_smtp" "Iis_webdav" "Iis_www"
91 "Indexsrv_system" "Inetprint" "Licenseserver" "Media_clips" "Media_utopia"
92 "Minesweeper" "Mousepoint" "Msmq_ADIntegrated" "Msmq_Core"
93 "Msmq_HTTPSupport" "Msmq_LocalStorage" "Msmq_MQDSService"
94 "Msmq_RoutingSupport" "Msmq_TriggersService" "Msnexplr" "Mswordpad"
95 "Netcis" "Netoc" "OEAccess" "Objectpkg" "Paint" "Pinball" "Pop3Admin"
96 "Pop3Service" "Pop3Srv" "Rec" "Reminst" "Rootautoupdate" "Rstorage" "SCW"
97 "Sakit_web" "Solitaire" "Spider" "TSWebClient" "Templates"
98 "TerminalServer" "UDDIAdmin" "UDDIDatabase" "UDDIWeb" "Vol" "WMAccess"
99 "WMPOCM" "WbemMSI" "Wms" "Wms_admin_asp" "Wms_admin_mmc" "Wms_isapi"
100 "Wms_server" "Zonegames"
101 ]}
102
103 [WindowsFirewall]
104 Profiles = WindowsFirewall.TurnOffFirewall
105
106 [WindowsFirewall.TurnOffFirewall]
107 Mode = 0
108
109 [SetupParams]
110 UserExecute = "${stdenv.lib.concatStringsSep " " afterSetup}"
111
112 [GuiRunOnce]
113 Command0 = "${cygwinRoot}\bin\bash -l ${shExecAfterwards}"
114 '';
115
116in stdenv.mkDerivation {
117 name = "unattended-floppy.img";
118 buildCommand = ''
119 dd if=/dev/zero of="$out" count=1440 bs=1024
120 ${dosfstools}/sbin/mkfs.msdos "$out"
121 ${mtools}/bin/mcopy -i "$out" "${winXpUnattended}" ::winnt.sif
122 '';
123}