Abstract autoUpgrade to separate file

Enable autoUpgrade for desktops (as well as server of course)
This commit is contained in:
Evie Litherland-Smith 2024-01-07 12:44:16 +00:00
parent d4f5b1f925
commit 9e81dac00a
5 changed files with 26 additions and 8 deletions

View file

@ -22,6 +22,7 @@
group = "users"; group = "users";
shell = "zsh"; shell = "zsh";
systemModules = [ ./system/hyprland.nix ]; systemModules = [ ./system/hyprland.nix ];
serviceModules = [ ];
homeModules = [ homeModules = [
./home/default.nix ./home/default.nix
./home/emacs.nix ./home/emacs.nix
@ -33,7 +34,8 @@
}; };
systemConfig = { hostName ? default.hostName, user ? default.user systemConfig = { hostName ? default.hostName, user ? default.user
, system ? default.system, group ? default.group, shell ? default.shell , 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 , homeModules ? default.homeModules, stateVersion ? default.stateVersion
}: }:
let specialArgs = { inherit hostName user; }; let specialArgs = { inherit hostName user; };
@ -209,13 +211,15 @@
in { in {
nixosConfigurations = { nixosConfigurations = {
## Server
Legion = let Legion = let
hostName = "Legion"; hostName = "Legion";
user = "xenia"; user = "xenia";
system = "x86_64-linux"; system = "x86_64-linux";
in systemConfig { in systemConfig {
inherit hostName user system; inherit hostName user system;
systemModules = [ ./system/default.nix ]; systemModules = [ ./system/default.nix ./system/autoupgrade.nix ];
serviceModules = [ serviceModules = [
./services/adguardhome.nix ./services/adguardhome.nix
./services/caddy.nix ./services/caddy.nix
@ -229,6 +233,8 @@
homeModules = [ ./home/default.nix ]; homeModules = [ ./home/default.nix ];
}; };
## Laptops
Northstar = let Northstar = let
hostName = "Northstar"; hostName = "Northstar";
user = "xenia"; user = "xenia";
@ -241,11 +247,16 @@
system = "x86_64-linux"; system = "x86_64-linux";
in systemConfig { inherit hostName user system; }; in systemConfig { inherit hostName user system; };
## Desktops
Scorch = let Scorch = let
hostName = "Scorch"; hostName = "Scorch";
user = "elitherl"; user = "elitherl";
system = "x86_64-linux"; system = "x86_64-linux";
in systemConfig { inherit hostName user system; }; in systemConfig {
inherit hostName user system;
systemModules = default.systemModules ++ [ ./system/autoupgrade.nix ];
};
Vanguard = let Vanguard = let
hostName = "Vanguard"; hostName = "Vanguard";
@ -253,7 +264,8 @@
system = "x86_64-linux"; system = "x86_64-linux";
in systemConfig { in systemConfig {
inherit hostName user system; 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 ]; homeModules = default.homeModules ++ [ ./home/games/default.nix ];
}; };

View file

@ -1,11 +1,9 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`). # and in the NixOS manual (accessible by running `nixos-help`).
{ lib, ... }: { { ... }: {
users.mutableUsers = false; users.mutableUsers = false;
system.autoUpgrade = { system.autoUpgrade = {
enable = true;
flake = "git+https://git.xenia.me.uk/xenia/nixos.git?ref=main";
dates = "02:30"; dates = "02:30";
allowReboot = true; allowReboot = true;
rebootWindow = { rebootWindow = {

View file

@ -14,4 +14,6 @@
''; '';
systemPackages = with pkgs; [ openfortivpn samba nomachine-client ]; systemPackages = with pkgs; [ openfortivpn samba nomachine-client ];
}; };
system.autoUpgrade.allowReboot = false;
} }

View file

@ -1 +1 @@
{ ... }: { } { ... }: { system.autoUpgrade.allowReboot = false; }

6
system/autoupgrade.nix Normal file
View file

@ -0,0 +1,6 @@
{ ... }: {
system.autoUpgrade = {
enable = true;
flake = "git+https://git.xenia.me.uk/xenia/nixos.git?ref=main";
};
}