From 9e81dac00adac2745d74672ed6aeb3bc168cdef0 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 7 Jan 2024 12:44:16 +0000 Subject: [PATCH] Abstract autoUpgrade to separate file Enable autoUpgrade for desktops (as well as server of course) --- flake.nix | 20 ++++++++++++++++---- hosts/Legion/configuration.nix | 4 +--- hosts/Ronin/configuration.nix | 2 ++ hosts/Vanguard/configuration.nix | 2 +- system/autoupgrade.nix | 6 ++++++ 5 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 system/autoupgrade.nix diff --git a/flake.nix b/flake.nix index b1cf4e80..67c0cf7b 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ group = "users"; shell = "zsh"; systemModules = [ ./system/hyprland.nix ]; + serviceModules = [ ]; homeModules = [ ./home/default.nix ./home/emacs.nix @@ -33,7 +34,8 @@ }; systemConfig = { hostName ? default.hostName, user ? default.user , system ? default.system, group ? default.group, shell ? default.shell - , systemModules ? default.systemModules, serviceModules ? [ ] + , systemModules ? default.systemModules + , serviceModules ? default.serviceModules , homeModules ? default.homeModules, stateVersion ? default.stateVersion }: let specialArgs = { inherit hostName user; }; @@ -209,13 +211,15 @@ in { nixosConfigurations = { + ## Server + Legion = let hostName = "Legion"; user = "xenia"; system = "x86_64-linux"; in systemConfig { inherit hostName user system; - systemModules = [ ./system/default.nix ]; + systemModules = [ ./system/default.nix ./system/autoupgrade.nix ]; serviceModules = [ ./services/adguardhome.nix ./services/caddy.nix @@ -229,6 +233,8 @@ homeModules = [ ./home/default.nix ]; }; + ## Laptops + Northstar = let hostName = "Northstar"; user = "xenia"; @@ -241,11 +247,16 @@ system = "x86_64-linux"; in systemConfig { inherit hostName user system; }; + ## Desktops + Scorch = let hostName = "Scorch"; user = "elitherl"; system = "x86_64-linux"; - in systemConfig { inherit hostName user system; }; + in systemConfig { + inherit hostName user system; + systemModules = default.systemModules ++ [ ./system/autoupgrade.nix ]; + }; Vanguard = let hostName = "Vanguard"; @@ -253,7 +264,8 @@ system = "x86_64-linux"; in systemConfig { inherit hostName user system; - systemModules = default.systemModules ++ [ ./system/steam.nix ]; + systemModules = default.systemModules + ++ [ ./system/autoupgrade.nix ./system/steam.nix ]; homeModules = default.homeModules ++ [ ./home/games/default.nix ]; }; diff --git a/hosts/Legion/configuration.nix b/hosts/Legion/configuration.nix index 0eaaf012..f70f6455 100644 --- a/hosts/Legion/configuration.nix +++ b/hosts/Legion/configuration.nix @@ -1,11 +1,9 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running `nixos-help`). -{ lib, ... }: { +{ ... }: { users.mutableUsers = false; system.autoUpgrade = { - enable = true; - flake = "git+https://git.xenia.me.uk/xenia/nixos.git?ref=main"; dates = "02:30"; allowReboot = true; rebootWindow = { diff --git a/hosts/Ronin/configuration.nix b/hosts/Ronin/configuration.nix index a265850e..5fb9b4c6 100644 --- a/hosts/Ronin/configuration.nix +++ b/hosts/Ronin/configuration.nix @@ -14,4 +14,6 @@ ''; systemPackages = with pkgs; [ openfortivpn samba nomachine-client ]; }; + + system.autoUpgrade.allowReboot = false; } diff --git a/hosts/Vanguard/configuration.nix b/hosts/Vanguard/configuration.nix index c915eb0a..8e749cbc 100644 --- a/hosts/Vanguard/configuration.nix +++ b/hosts/Vanguard/configuration.nix @@ -1 +1 @@ -{ ... }: { } +{ ... }: { system.autoUpgrade.allowReboot = false; } diff --git a/system/autoupgrade.nix b/system/autoupgrade.nix new file mode 100644 index 00000000..143ce826 --- /dev/null +++ b/system/autoupgrade.nix @@ -0,0 +1,6 @@ +{ ... }: { + system.autoUpgrade = { + enable = true; + flake = "git+https://git.xenia.me.uk/xenia/nixos.git?ref=main"; + }; +}