From 87e48ad76a273e05ebb43206b2ff2fe672663191 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sun, 29 Dec 2024 11:38:35 +0200 Subject: [PATCH] Gave auto update it's own module --- host/configuration.nix | 13 ++++--------- nixosModules/auto-updade.nix | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 nixosModules/auto-updade.nix diff --git a/host/configuration.nix b/host/configuration.nix index bd382e9..625e332 100644 --- a/host/configuration.nix +++ b/host/configuration.nix @@ -5,6 +5,7 @@ ./disk-config.nix ./../nixosModules/secrets.nix ./../nixosModules/website.nix + ./../nixosModules/auto-updade.nix ]; boot.loader.grub = { @@ -12,6 +13,7 @@ efiInstallAsRemovable = true; }; + # Admin utilities environment.systemPackages = with pkgs; map lib.lowPrio [ curl gitMinimal @@ -30,15 +32,8 @@ secrets.enable = true; website.enable = true; - system.autoUpgrade = { - enable = true; - flake = "github:kyren223/server#default"; - dates = "minutely"; # Poll interval - flags = [ - "--no-write-lock-file" # Prevent flake.lock from upgrading - "--option" "tarball-ttl" "0" # Required for polling below 1h - ]; - }; + # Automatically pull this config from git + autoUpdate.enable = true; nix.settings.extra-experimental-features = [ "nix-command" "flakes" ]; diff --git a/nixosModules/auto-updade.nix b/nixosModules/auto-updade.nix new file mode 100644 index 0000000..6fec6a1 --- /dev/null +++ b/nixosModules/auto-updade.nix @@ -0,0 +1,18 @@ +{ pkgs, lib, config, ... }: { + + options = { + autoUpdate.enable = lib.mkEnableOption "enables autoUpdate"; + }; + + config = lib.mkIf config.autoUpdate.enable { + system.autoUpgrade = { + enable = true; + flake = "github:kyren223/server#default"; + dates = "minutely"; # Poll interval + flags = [ + "--no-write-lock-file" # Prevent flake.lock from upgrading + "--option" "tarball-ttl" "0" # Required for polling below 1h + ]; + }; + }; +}