aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts/deep-clean.sh
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-07-18 14:55:21 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-07-18 14:55:21 +0530
commit03bd9b6ad5335aff65d9cb6fb1d117b5cb4b7919 (patch)
tree04780c0d23aac335fe60320c181bd3ac6850d5d3 /modules/scripts/deep-clean.sh
parentbde84587b2a408970086f4c708ac9a629abfa554 (diff)
downloadhome-manager-config-03bd9b6ad5335aff65d9cb6fb1d117b5cb4b7919.tar.gz
home-manager-config-03bd9b6ad5335aff65d9cb6fb1d117b5cb4b7919.zip
refactor(scripts): split monolithic module into per-script submodules
Extract shared `mkScript` and `mkScriptModule` helpers into `lib.nix` Split each script into `modules/scripts/<name>/` with its own `default.nix`, `script.sh`, and `assertions.nix` Remove `conditions` parameter from `mkScriptModule`; move condition assertions into per-script `assertions.nix` files with inline checks and error messages Simplify `mkScriptModule` to return `{ options, moduleConfig }` instead of a module function, taking `config` as a direct parameter Add `description` field to `mkScript` that inserts the description as a `# <text>` comment between the shebang and env vars Thread `description` through `mkScriptModule` to each `default.nix` Move top comment lines from each `script.sh` into the `description` field and remove from sources to avoid duplication Remove old flat `.sh` files from `modules/scripts/` root
Diffstat (limited to 'modules/scripts/deep-clean.sh')
-rw-r--r--modules/scripts/deep-clean.sh33
1 files changed, 0 insertions, 33 deletions
diff --git a/modules/scripts/deep-clean.sh b/modules/scripts/deep-clean.sh
deleted file mode 100644
index 5d1c87a..0000000
--- a/modules/scripts/deep-clean.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-# Deep clean script for Nix systems
-# Removes old generations, garbage, and optimizes store
-# WARNING: Do NOT run with sudo - run as normal user
-echo "--- Starting Nix Deep Clean ---"
-
-if [[ $EUID -eq 0 ]]; then
- echo "Error: Do not run this script with 'sudo ./clean-nix.sh'."
- echo "Run it as your normal user; it will ask for your password when needed."
- exit 1
-fi
-
-echo "Cleaning system generations..."
-sudo nix-env -p /nix/var/nix/profiles/system --delete-generations old
-
-if command -v home-manager &> /dev/null; then
- echo "Cleaning Home Manager generations..."
- home-manager expire-generations "-0 days"
-fi
-
-echo "Cleaning user generations..."
-nix-env --delete-generations old
-
-echo "Removing 'result' symlinks in current directory..."
-find . -name "result" -type l -delete
-
-echo "Running Garbage Collector..."
-sudo nix-collect-garbage -d
-nix-collect-garbage -d
-
-echo "Optimising the store (deduplicating files)..."
-nix store optimise
-
-echo "--- Clean Up Complete ---"