Disco: Wake up system for auto-upgrades

This commit is contained in:
fruchti 2023-03-12 12:55:11 +01:00
parent 1b67df787a
commit a4b0edf7f0

View file

@ -124,7 +124,6 @@ in
"steam-run"
];
fileSystems."/windows" = {
device = "/dev/disk/by-uuid/C61C2B5E1C2B492F";
fsType = "ntfs";
@ -142,6 +141,35 @@ in
};
};
system.autoUpgrade = {
enable = true;
allowReboot = false;
sendEmail = true;
gitPull = true;
gitUser = "fruchti";
};
systemd.timers.nixos-upgrade = {
timerConfig = {
WakeSystem = true;
};
};
systemd.services.nixos-upgrade = let
updateScript = (pkgs.writeShellScriptBin "nixos-upgrade" ''
set -e
${config.systemd.services.nixos-upgrade.script}
'');
in {
unitConfig = {
ConditionACPower = true;
Requires = [ "network-online.target" ];
};
serviceConfig = {
# Workaround for https://github.com/systemd/systemd/issues/14045
ExecStartPre = "${pkgs.coreutils}/bin/sleep 10s";
ExecStart = lib.mkForce "systemd-inhibit --what=sleep --mode=delay --why='NixOS upgrade' ${updateScript}/bin/nixos-upgrade";
};
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave