cleanNix: set systemd timer

This commit is contained in:
2026-05-18 19:16:09 +02:00
parent 9425c5f740
commit d71a5e4356
3 changed files with 46 additions and 1 deletions
+1
View File
@@ -23,6 +23,7 @@
../../hostsModules/laptop/nixos/ollama.nix # llm config ../../hostsModules/laptop/nixos/ollama.nix # llm config
../../modules/nixos/mullvad.nix # vpn config ../../modules/nixos/mullvad.nix # vpn config
../../hostsModules/laptop/nixos/autoUpdate.nix # auto update the flakes. Handles notification via libnotify and matrix-commander-rs ../../hostsModules/laptop/nixos/autoUpdate.nix # auto update the flakes. Handles notification via libnotify and matrix-commander-rs
../../hostsModules/laptop/nixos/cleanNix.nix # uses alexandra deadnix and statix to clean the whole config
../../hostsModules/laptop/nixos/bootloader.nix ../../hostsModules/laptop/nixos/bootloader.nix
../../hostsModules/laptop/nixos/networking.nix # firewall, ssh, networkmanager, etc. ../../hostsModules/laptop/nixos/networking.nix # firewall, ssh, networkmanager, etc.
../../modules/nixos/bluetooth.nix ../../modules/nixos/bluetooth.nix
+45
View File
@@ -0,0 +1,45 @@
{pkgs, ...}: {
# Ensure your script is available system-wide
environment.systemPackages = [
(pkgs.callPackage ../scripts/cleanNix.nix {})
];
users.users.tomasr = {
linger = true; # lingering is required
};
systemd.user.services.custom-autoupdate = {
description = "NixOS configuration auto cleanup";
serviceConfig = {
Type = "oneshot";
ExecStart = "/run/current-system/sw/bin/custom-cleanNix";
# safety for long rebuilds
TimeoutStartSec = "45min";
TimeoutStopSec = "10min";
# avoid overlap
RemainAfterExit = true;
# tweaks that should make the system run normally during the rebuilds
Nice = 10;
IOSchedulingClass = "best-effort";
IOSchedulingPriority = 7;
};
};
# Systemd USER timer
systemd.user.timers.custom-autoupdate = {
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "Sat *-*-* 20:00:00"; # runs saturday night. If for whatever reason something breaks. I have whole sunday to fix it.
Persistent = true; # if it happens during shutted down
# avoids thundering herd on boot
RandomizedDelaySec = "2h";
};
};
}
-1
View File
@@ -31,6 +31,5 @@
vimPluginsUpdater # used for building plugins vimPluginsUpdater # used for building plugins
nix-index nix-index
statix statix
(pkgs.callPackage ../../hostsModules/laptop/scripts/cleanNix.nix {})
]; ];
} }