From 54ee47b2db3ec471fa689cd600477da970af0049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= <torjus@usit.uio.no> Date: Sat, 12 Oct 2024 21:27:02 +0200 Subject: [PATCH] Add weekly-rebuild timer --- system/default.nix | 11 +++++++---- system/packages.nix | 6 ++++++ system/weekly-rebuild.nix | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 system/packages.nix create mode 100644 system/weekly-rebuild.nix diff --git a/system/default.nix b/system/default.nix index debf8f0..d84bc65 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,8 +1,11 @@ -{ ... }: { +{ ... }: +{ imports = [ - ./sops.nix - ./root-user.nix - ./sshd.nix ./monitoring.nix + ./packages.nix + ./root-user.nix + ./sops.nix + ./sshd.nix + ./weekly-rebuild.nix ]; } diff --git a/system/packages.nix b/system/packages.nix new file mode 100644 index 0000000..57746ab --- /dev/null +++ b/system/packages.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = [ + pkgs.git + ]; +} diff --git a/system/weekly-rebuild.nix b/system/weekly-rebuild.nix new file mode 100644 index 0000000..2c387b7 --- /dev/null +++ b/system/weekly-rebuild.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: +{ + systemd.services."weekly-rebuild" = { + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.nixos-rebuild}/bin/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"; + }; + }; +}