From 52e88c1da11c5657b95358c6fcfc6313b58ab4b7 Mon Sep 17 00:00:00 2001 From: oqyude Date: Sat, 16 May 2026 12:46:59 +0300 Subject: [PATCH] systemd-routine - prebuild --- configurations/vds.nix | 10 +++---- modules/essentials/default.nix | 2 +- modules/essentials/packages.nix | 2 +- modules/essentials/systemd-routine.nix | 26 ----------------- modules/essentials/systemd-routines.nix | 39 +++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 33 deletions(-) delete mode 100644 modules/essentials/systemd-routine.nix create mode 100644 modules/essentials/systemd-routines.nix diff --git a/configurations/vds.nix b/configurations/vds.nix index 924f6f1..9bc4e16 100644 --- a/configurations/vds.nix +++ b/configurations/vds.nix @@ -77,10 +77,10 @@ let nameservers = [ "1.1.1.1" "8.8.8.8" - "2001:4860:4860::8844" - "2001:4860:4860::8888" - "2606:4700:4700::1111" - "2606:4700:4700::1001" + # "2001:4860:4860::8844" + # "2001:4860:4860::8888" + # "2606:4700:4700::1111" + # "2606:4700:4700::1001" ]; hostName = "${xlib.device.hostname}"; networkmanager.enable = true; @@ -115,7 +115,7 @@ let } ''; }; - enableIPv6 = true; + enableIPv6 = false; interfaces.ens3 = { useDHCP = true; # ipv4.addresses = [ diff --git a/modules/essentials/default.nix b/modules/essentials/default.nix index c8e356a..3a8a275 100644 --- a/modules/essentials/default.nix +++ b/modules/essentials/default.nix @@ -7,7 +7,7 @@ ./packages.nix ./services.nix ./settings.nix - # ./systemd-routine.nix + ./systemd-routines.nix ./shell.nix ]; } diff --git a/modules/essentials/packages.nix b/modules/essentials/packages.nix index 2b8625a..5d15ae5 100644 --- a/modules/essentials/packages.nix +++ b/modules/essentials/packages.nix @@ -202,7 +202,7 @@ in flake = "/etc/nixos"; clean = { enable = true; - extraArgs = "--keep 3 --keep-since 2d"; + extraArgs = "--keep 2 --keep-since 2d"; dates = "daily"; }; }; diff --git a/modules/essentials/systemd-routine.nix b/modules/essentials/systemd-routine.nix deleted file mode 100644 index fcb068c..0000000 --- a/modules/essentials/systemd-routine.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - xlib, - ... -}: -{ - systemd = { - services.nixos-auto-rebuild = { - description = "Auto rebuild NixOS config"; - serviceConfig = { - Type = "oneshot"; - User = "${xlib.device.username}"; - WorkingDirectory = "/etc/nixos"; - ExecStart = "gp-ns"; - }; - }; - timers.nixos-auto-rebuild = { - description = "Run NixOS auto rebuild at 4am daily"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "*-*-* 04:00:00"; - Persistent = true; - }; - }; - }; -} diff --git a/modules/essentials/systemd-routines.nix b/modules/essentials/systemd-routines.nix new file mode 100644 index 0000000..c3a8603 --- /dev/null +++ b/modules/essentials/systemd-routines.nix @@ -0,0 +1,39 @@ +{ + config, + pkgs, + xlib, + ... +}: +{ + systemd = { + services = { + nixos-prebuild = { + description = "Prebuild NixOS closure"; + serviceConfig = { + CPUQuota = "20%"; + User = "oqyude"; + Group = "users"; + Nice = 10; + Type = "oneshot"; + WorkingDirectory = "/tmp"; + Environment = [ + "HOME=/home/oqyude" + ]; + ExecStart = '' + ${pkgs.nix}/bin/nix build --no-link /etc/nixos#nixosConfigurations.${config.networking.hostName}.config.system.build.toplevel + ''; + }; + wantedBy = [ "multi-user.target" ]; + }; + }; + timers = { + nixos-prebuild = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*-*-* 04:00:00"; + Persistent = true; + }; + }; + }; + }; +} \ No newline at end of file