From 57d79fc56373419edf2066962a90afaf79c38979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sat, 12 Oct 2024 21:27:02 +0200 Subject: [PATCH] Add weekly-rebuild timer --- system/default.nix | 4 +++- system/weekly-rebuild.nix | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 system/weekly-rebuild.nix diff --git a/system/default.nix b/system/default.nix index debf8f0..e25f748 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,8 +1,10 @@ -{ ... }: { +{ ... }: +{ imports = [ ./sops.nix ./root-user.nix ./sshd.nix ./monitoring.nix + ./weekly-rebuild.nix ]; } diff --git a/system/weekly-rebuild.nix b/system/weekly-rebuild.nix new file mode 100644 index 0000000..e38ad3f --- /dev/null +++ b/system/weekly-rebuild.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: +{ + systemd.services."weekly-rebuild" = { + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.bash}/bin/bash -c 'nixos-rebuild --boot --flake git+https://git.t-juice.club/torjus/nixos-servers'"; + }; + }; + systemd.timers."weekly-rebuild" = { + enable = true; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "Sun 06:00:00"; + }; + }; +}