nixos-servers/system/weekly-rebuild.nix

22 lines
537 B
Nix

{ pkgs, ... }:
{
systemd.services."weekly-rebuild" = {
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#";
ExecStartPost = "${pkgs.nix}/bin/nix-collect-garbage --delete-older-than 30d";
};
};
systemd.timers."weekly-rebuild" = {
enable = true;
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "Sun 06:00:00";
};
};
}