diff --git a/modules/applications/zsh.nix b/modules/applications/zsh.nix index ba63c59..f46d979 100644 --- a/modules/applications/zsh.nix +++ b/modules/applications/zsh.nix @@ -33,7 +33,7 @@ _: { command cat "$@" fi } - + custom-eza() { # behaves differently if we just call it or if we pipe initContent if [[ -t 1 ]]; then eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" diff --git a/modules/hardware/disko/disko-config.nix b/modules/hardware/disko/disko-config.nix index 57bdd43..17dc4e3 100644 --- a/modules/hardware/disko/disko-config.nix +++ b/modules/hardware/disko/disko-config.nix @@ -119,4 +119,4 @@ disk = { }; }; }; -}; +};};} diff --git a/modules/utilities/autoCleanup.nix b/modules/utilities/autoCleanup.nix index 2215006..04f3058 100644 --- a/modules/utilities/autoCleanup.nix +++ b/modules/utilities/autoCleanup.nix @@ -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 { name = "custom-cleanNix"; @@ -120,60 +173,6 @@ 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 { name = "custom-cleanNix"; diff --git a/modules/utilities/autoUpdate.nix b/modules/utilities/autoUpdate.nix index c4b0e2b..a38c240 100644 --- a/modules/utilities/autoUpdate.nix +++ b/modules/utilities/autoUpdate.nix @@ -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 { name = "custom-autoupdate"; @@ -106,54 +153,6 @@ 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 { name = "custom-autoupdate";