1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00

Remove collect garbage option from rebuild script

This commit is contained in:
RGBCube 2023-11-08 08:38:38 +03:00
parent 9ec2173a9e
commit 5e1684a6c1
No known key found for this signature in database

View file

@ -1,34 +1,15 @@
#!/bin/sh #!/bin/sh
if [[ $1 == "-h" || $1 == "--help" ]]; then if [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [-h | --help] [-c | --clean-garbage] [machine]" echo "Usage: $0 [-h | --help] [machine]"
exit exit
fi fi
machine= machine=$1
if [[ $1 != "" ]]; then
if [[ $1 != "-c" && $1 != "--clean-garbage" ]]; then
# Use the first argument if it exists and is not clean-garbage.
machine=$1
elif [[ $2 != "" ]]; then
# Use the second argument if the first argument is clean-garbage and the second argument exists.
machine=$2
fi
fi
if [[ $machine == "" ]]; then if [[ $machine == "" ]]; then
available_machines=$(ls --format=commas machines) available_machines=$(ls --format=commas machines)
read -p "What machine would you like to build? (Possible options: $available_machines): " machine read -p "What machine would you like to build? (Possible options: $available_machines): " machine
fi fi
if [[ $1 == "-c" || $1 == "--clean-garbage" ]]; then nix-shell --packages git --command "sudo nixos-rebuild switch --flake .#$machine"
clean_garbage=Y
else
read -p "Clean garbage? [y/N]: " clean_garbage
fi
nix-shell --packages git --command "sudo nixos-rebuild switch --flake .#$machine" || exit 1
if [[ $clean_garbage =~ ^[Yy]$ ]]; then
sudo nix-collect-garbage --delete-old
fi