nixos-edit: add clean mode
This commit is contained in:
parent
2886fb86e9
commit
dcae161f30
1 changed files with 10 additions and 0 deletions
|
@ -12,6 +12,7 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
echo " - test -- edits the OS and switches"
|
||||
echo " - push -- commits edits from test and pushes them"
|
||||
echo " - update -- update the system"
|
||||
echo " - clean -- does housekeeping"
|
||||
echo " - init -- initialize the system (only run once)"
|
||||
echo
|
||||
echo "edit is the default mode."
|
||||
|
@ -74,6 +75,15 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
exec sudo -iu tudbut nixos-edit $1 || exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "clean" ] ; then
|
||||
echo "> running gc"
|
||||
sudo nix-collect-garbage --delete-older-than 60d
|
||||
echo "> hard-linking"
|
||||
sudo nix-store --optimise
|
||||
echo "> all done"
|
||||
exit
|
||||
fi
|
||||
|
||||
[ "$1" = "edit" ] || [ "$1" = "" ] || [ "$1" = "push" ]
|
||||
PUSH=$?
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue