mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
cleanNix: set systemd timer
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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 {})
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user