diff --git a/hosts/Disco.nix b/hosts/Disco.nix index c90290d..3af4ef5 100644 --- a/hosts/Disco.nix +++ b/hosts/Disco.nix @@ -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. It‘s perfectly fine and recommended to leave