diff --git a/modules/nixos/system/autoUpgrade/default.nix b/modules/nixos/system/autoUpgrade/default.nix new file mode 100644 index 0000000..b9947c1 --- /dev/null +++ b/modules/nixos/system/autoUpgrade/default.nix @@ -0,0 +1,33 @@ +{ + options, + config, + pkgs, + lib, + inputs, + ... +}: +with lib; +with lib.wyrdgard; +let + cfg = config.wyrdgard.system.autoUpgrade; +in +{ + options.wyrdgard.system.autoUpgrade = with types; { + enable = mkEnableOption "Enable auto-upgrade"; + time = mkOpt str "02:00" "Time to run auto-upgrade"; + }; + + config = mkIf cfg.enable { + system.autoUpgrade = { + enable = true; + flake = inputs.self.outPath; + flags = [ + "--update-input" + "nixpkgs" + "--print-build-logs" + ]; + dates = cfg.time; + randomizedDelaySec = "45min"; + }; + }; +} diff --git a/systems/x86_64-linux/yggdrasil/default.nix b/systems/x86_64-linux/yggdrasil/default.nix index 57aff4e..29bddb0 100644 --- a/systems/x86_64-linux/yggdrasil/default.nix +++ b/systems/x86_64-linux/yggdrasil/default.nix @@ -24,11 +24,17 @@ with lib.wyrdgard; _1password = enabled; }; - system.hardware = { + system = { + autoUpgrade = { + enable = true; + time = "10:00"; + }; + hardware = { bluetooth = enabled; gpu.nvidia = enabled; }; }; + }; system.stateVersion = "23.11"; }