diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index c71456d..e7c72b3 100755 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -23,7 +23,7 @@ ../../hostsModules/laptop/nixos/ollama.nix # llm 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/cleanNix.nix # uses alexandra deadnix and statix to clean the whole config + ../../hostsModules/laptop/nixos/autoCleanup.nix # uses alexandra deadnix and statix to clean the whole config ../../hostsModules/laptop/nixos/bootloader.nix ../../hostsModules/laptop/nixos/networking.nix # firewall, ssh, networkmanager, etc. ../../modules/nixos/bluetooth.nix diff --git a/hostsModules/laptop/nixos/autoCleanup.nix b/hostsModules/laptop/nixos/autoCleanup.nix index af6545c..8d0de9e 100644 --- a/hostsModules/laptop/nixos/autoCleanup.nix +++ b/hostsModules/laptop/nixos/autoCleanup.nix @@ -7,7 +7,7 @@ linger = true; # lingering is required }; - systemd.user.services.custom-autoupdate = { + systemd.user.services.custom-cleanNix = { description = "NixOS configuration auto cleanup"; serviceConfig = { @@ -30,7 +30,7 @@ }; # Systemd USER timer - systemd.user.timers.custom-autoupdate = { + systemd.user.timers.custom-cleanNix = { wantedBy = ["timers.target"]; timerConfig = { diff --git a/hostsModules/laptop/scripts/cleanNix.nix b/hostsModules/laptop/scripts/cleanNix.nix index f89278d..7ee031b 100644 --- a/hostsModules/laptop/scripts/cleanNix.nix +++ b/hostsModules/laptop/scripts/cleanNix.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: +{pkgs, +...}: pkgs.writeShellApplication { name = "custom-cleanNix"; @@ -25,10 +26,16 @@ pkgs.writeShellApplication { git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-cleanup-$TIME" git -C "$FLAKE_DIR" tag "pre-cleanup-$TIME" HEAD - # removes dead code - deadnix --edit "$FLAKE_DIR" # removes unused code - statix fix "$FLAKE_DIR" # check other linting issues - alejandra "$FLAKE_DIR" # formats the config + # the echos are to separate what each one is doing. Just for curiosity + echo "deadnix scans your Nix code and removes or reports unused (dead) variables and bindings" + deadnix -vv --edit "$FLAKE_DIR" # removes unused code + echo "--------------------------------------------------------------" + echo "statix lints your Nix code to find stylistic issues, bad patterns, and potential mistakes." + statix fix "$FLAKE_DIR" --verbose # check other linting issues + echo "--------------------------------------------------------------" + echo "alejandra formats your Nix code consistently according to a strict, opinionated style." + alejandra -v "$FLAKE_DIR" # formats the config + echo "--------------------------------------------------------------" if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule