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:
parent
9ec2173a9e
commit
5e1684a6c1
1 changed files with 3 additions and 22 deletions
25
rebuild.sh
25
rebuild.sh
|
@ -1,34 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||
echo "Usage: $0 [-h | --help] [-c | --clean-garbage] [machine]"
|
||||
echo "Usage: $0 [-h | --help] [machine]"
|
||||
exit
|
||||
fi
|
||||
|
||||
machine=
|
||||
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
|
||||
machine=$1
|
||||
|
||||
if [[ $machine == "" ]]; then
|
||||
available_machines=$(ls --format=commas machines)
|
||||
read -p "What machine would you like to build? (Possible options: $available_machines): " machine
|
||||
fi
|
||||
|
||||
if [[ $1 == "-c" || $1 == "--clean-garbage" ]]; then
|
||||
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
|
||||
nix-shell --packages git --command "sudo nixos-rebuild switch --flake .#$machine"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue