- Simplified command cases by removing unnecessary semicolons.
- Improved error handling in rebuild.nix for clarity and consistency.
This commit is contained in:
@ -1,10 +1,7 @@
|
||||
# ncli/commands/maintenance.nix — cleanup, diag, list-gens, trim, home-backups
|
||||
lib:
|
||||
|
||||
let
|
||||
lib: let
|
||||
inherit (lib) project;
|
||||
in
|
||||
{
|
||||
in {
|
||||
cleanup_case = ''
|
||||
echo "Warning! This will remove old generations of your system."
|
||||
read -p "How many generations to keep (default: all)? " keep_count
|
||||
@ -33,7 +30,6 @@ in
|
||||
echo "Cleaning up old log files..." >> "$LOG_FILE"
|
||||
find "$LOG_DIR" -type f -mtime +3 -name "*.log" -delete >> "$LOG_FILE" 2>&1
|
||||
echo "Cleanup process logged to $LOG_FILE"
|
||||
;;
|
||||
'';
|
||||
|
||||
diag_case = ''
|
||||
@ -50,7 +46,6 @@ in
|
||||
echo ""
|
||||
} > "$HOME/diag.txt"
|
||||
echo "Diagnostic report saved to $HOME/diag.txt"
|
||||
;;
|
||||
'';
|
||||
|
||||
list_gens_case = ''
|
||||
@ -59,7 +54,6 @@ in
|
||||
echo ""
|
||||
echo "--- System Generations ---"
|
||||
nix profile history --profile /nix/var/nix/profiles/system | cat || echo "Could not list system generations."
|
||||
;;
|
||||
'';
|
||||
|
||||
trim_case = ''
|
||||
@ -73,11 +67,9 @@ in
|
||||
else
|
||||
echo "Trim operation cancelled."
|
||||
fi
|
||||
;;
|
||||
'';
|
||||
|
||||
home_backups_case = ''
|
||||
ls -a ~ | grep backup
|
||||
;;
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user