From b7d9a12786170feed688b2119efd514c017f9c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sat, 12 Oct 2024 21:52:05 +0200 Subject: [PATCH] Collect garbage after rebuild --- system/weekly-rebuild.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/system/weekly-rebuild.nix b/system/weekly-rebuild.nix index 1f04614..b52cbd4 100644 --- a/system/weekly-rebuild.nix +++ b/system/weekly-rebuild.nix @@ -1,10 +1,17 @@ { pkgs, ... }: { systemd.services."weekly-rebuild" = { - path = [ pkgs.git ]; + path = [ + pkgs.git + pkgs.nix + ]; serviceConfig = { Type = "oneshot"; - ExecStart = "${pkgs.nixos-rebuild}/bin/nixos-rebuild boot --flake git+https://git.t-juice.club/torjus/nixos-servers"; + ExecStart = "${pkgs.nixos-rebuild}/bin/nixos-rebuild boot --flake git+https://git.t-juice.club/torjus/nixos-servers#"; + ExecStartPost = [ + "${pkgs.nix}/bin/nix-collect-garbage --delete-older-than 30d" + "${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake git+https://git.t-juice.club/torjus/nixos-servers#" + ]; }; }; systemd.timers."weekly-rebuild" = {