mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
snapshot pre-cleanup-2026-06-04T16-10-09Z
This commit is contained in:
@@ -119,4 +119,4 @@ disk = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};};}
|
||||||
|
|||||||
@@ -49,7 +49,60 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
perSystem = {pkgs, ...}: {
|
|
||||||
|
|
||||||
|
## Desktop
|
||||||
|
flake.nixosModules.autoCleanup-desktop = {
|
||||||
|
pkgs,
|
||||||
|
pkgs-unstable,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# Ensure your script is available system-wide
|
||||||
|
environment.systemPackages = [
|
||||||
|
self.packages.${pkgs.system}.custom-cleanNix-desktop
|
||||||
|
pkgs-unstable.statix
|
||||||
|
];
|
||||||
|
users.users.tomasr = {
|
||||||
|
linger = true; # lingering is required
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.services.custom-cleanNix = {
|
||||||
|
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-cleanNix = {
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
perSystem = {pkgs, ...}: {
|
||||||
packages.custom-cleanNix-laptop = pkgs.writeShellApplication {
|
packages.custom-cleanNix-laptop = pkgs.writeShellApplication {
|
||||||
name = "custom-cleanNix";
|
name = "custom-cleanNix";
|
||||||
|
|
||||||
@@ -120,60 +173,6 @@
|
|||||||
rm -f "$ERROR_FILE"
|
rm -f "$ERROR_FILE"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
## Desktop
|
|
||||||
flake.nixosModules.autoCleanup-desktop = {
|
|
||||||
pkgs,
|
|
||||||
pkgs-unstable,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
# Ensure your script is available system-wide
|
|
||||||
environment.systemPackages = [
|
|
||||||
self.packages.${pkgs.system}.custom-cleanNix-desktop
|
|
||||||
pkgs-unstable.statix
|
|
||||||
];
|
|
||||||
users.users.tomasr = {
|
|
||||||
linger = true; # lingering is required
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.user.services.custom-cleanNix = {
|
|
||||||
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-cleanNix = {
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
perSystem = {pkgs, ...}: {
|
|
||||||
packages.custom-cleanNix-desktop = pkgs.writeShellApplication {
|
packages.custom-cleanNix-desktop = pkgs.writeShellApplication {
|
||||||
name = "custom-cleanNix";
|
name = "custom-cleanNix";
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,54 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
perSystem = {pkgs, ...}: {
|
|
||||||
|
## desktop
|
||||||
|
flake.nixosModules.autoUpdate-desktop = {pkgs, ...}: {
|
||||||
|
# Ensure your script is available system-wide
|
||||||
|
environment.systemPackages = [
|
||||||
|
self.packages.${pkgs.system}.custom-autoupdate-desktop
|
||||||
|
];
|
||||||
|
users.users.tomasr = {
|
||||||
|
linger = true; # lingering is required
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.services.custom-autoupdate = {
|
||||||
|
description = "NixOS flake auto update";
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
|
||||||
|
ExecStart = "/run/current-system/sw/bin/custom-autoupdate";
|
||||||
|
|
||||||
|
# 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 = "Fri *-*-* 20:00:00"; # runs friday night. If for whatever reason something breaks. I have whole week-end to fix it.
|
||||||
|
|
||||||
|
Persistent = true; # if it happens during shutted down
|
||||||
|
|
||||||
|
# avoids thundering herd on boot
|
||||||
|
RandomizedDelaySec = "2h";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
perSystem = {pkgs, ...}: {
|
||||||
packages.custom-autoupdate-laptop = pkgs.writeShellApplication {
|
packages.custom-autoupdate-laptop = pkgs.writeShellApplication {
|
||||||
name = "custom-autoupdate";
|
name = "custom-autoupdate";
|
||||||
|
|
||||||
@@ -106,54 +153,6 @@
|
|||||||
rm -f "$ERROR_FILE"
|
rm -f "$ERROR_FILE"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
## desktop
|
|
||||||
flake.nixosModules.autoUpdate-desktop = {pkgs, ...}: {
|
|
||||||
# Ensure your script is available system-wide
|
|
||||||
environment.systemPackages = [
|
|
||||||
self.packages.${pkgs.system}.custom-autoupdate-desktop
|
|
||||||
];
|
|
||||||
users.users.tomasr = {
|
|
||||||
linger = true; # lingering is required
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.user.services.custom-autoupdate = {
|
|
||||||
description = "NixOS flake auto update";
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
|
|
||||||
ExecStart = "/run/current-system/sw/bin/custom-autoupdate";
|
|
||||||
|
|
||||||
# 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 = "Fri *-*-* 20:00:00"; # runs friday night. If for whatever reason something breaks. I have whole week-end to fix it.
|
|
||||||
|
|
||||||
Persistent = true; # if it happens during shutted down
|
|
||||||
|
|
||||||
# avoids thundering herd on boot
|
|
||||||
RandomizedDelaySec = "2h";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
perSystem = {pkgs, ...}: {
|
|
||||||
packages.custom-autoupdate-desktop = pkgs.writeShellApplication {
|
packages.custom-autoupdate-desktop = pkgs.writeShellApplication {
|
||||||
name = "custom-autoupdate";
|
name = "custom-autoupdate";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user