Add a few Windows settings #10
|
@ -37,7 +37,17 @@ wfvm.makeWindowsImage {
|
||||||
# administratorPassword = "12345";
|
# administratorPassword = "12345";
|
||||||
|
|
||||||
# Imperative installation commands, to be installed incrementally
|
# Imperative installation commands, to be installed incrementally
|
||||||
installCommands = with wfvm.layers; [ anaconda3 msys2 msvc msvc-ide-unbreak ];
|
installCommands =
|
||||||
|
if impureMode
|
||||||
|
then []
|
||||||
|
else with wfvm.layers; [
|
||||||
|
(collapseLayers [
|
||||||
|
disable-autosleep
|
||||||
|
disable-autolock
|
||||||
|
disable-firewall
|
||||||
|
])
|
||||||
|
anaconda3 msys2 msvc msvc-ide-unbreak
|
||||||
|
];
|
||||||
|
|
||||||
# services = {
|
# services = {
|
||||||
# # Enable remote management
|
# # Enable remote management
|
||||||
|
|
|
@ -122,4 +122,47 @@ in
|
||||||
sleep 40
|
sleep 40
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
# Disable the Windows firewall
|
||||||
|
disable-firewall = {
|
||||||
|
name = "disable-firewall";
|
||||||
|
script = ''
|
||||||
|
echo Disabling firewall
|
||||||
|
win-exec "netsh advfirewall set allprofiles state off"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# Disable automatic power management which causes the machine to go
|
||||||
|
# into standby after periods without mouse wiggling.
|
||||||
|
disable-autosleep = {
|
||||||
|
name = "disable-autosleep";
|
||||||
|
script = ''
|
||||||
|
echo Disabling autosleep
|
||||||
|
win-exec "powercfg /x -hibernate-timeout-ac 0"
|
||||||
|
win-exec "powercfg /x -hibernate-timeout-dc 0"
|
||||||
|
win-exec "powercfg /x -disk-timeout-ac 0"
|
||||||
|
win-exec "powercfg /x -disk-timeout-dc 0"
|
||||||
|
win-exec "powercfg /x -monitor-timeout-ac 0"
|
||||||
|
win-exec "powercfg /x -monitor-timeout-dc 0"
|
||||||
|
win-exec "powercfg /x -standby-timeout-ac 0"
|
||||||
|
win-exec "powercfg /x -standby-timeout-dc 0"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# Turn off automatic locking of idle user sessions
|
||||||
|
disable-autolock = {
|
||||||
|
name = "disable-autolock";
|
||||||
|
script = ''
|
||||||
|
echo Disabling autolock
|
||||||
|
win-exec "reg add HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Personalization /v NoLockScreen /t REG_DWORD /d 1"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Chain together layers that are quick to run so that the VM does
|
||||||
|
# not have to be started/shutdown for each.
|
||||||
|
collapseLayers = scripts: {
|
||||||
|
name = pkgs.lib.concatMapStringsSep "-" ({ name, ... }: name) scripts;
|
||||||
|
script = builtins.concatStringsSep "\n" (
|
||||||
|
map ({ script, ... }: script) scripts
|
||||||
|
);
|
||||||
|
buildInputs =
|
||||||
|
builtins.concatMap ({ buildInputs ? [], ... }: buildInputs) scripts;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue