From 5e1684a6c18e3b5b222b5542a59d3c15528c901d Mon Sep 17 00:00:00 2001 From: RGBCube Date: Wed, 8 Nov 2023 08:38:38 +0300 Subject: [PATCH] Remove collect garbage option from rebuild script --- rebuild.sh | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/rebuild.sh b/rebuild.sh index 228a44b..cbfa71a 100755 --- a/rebuild.sh +++ b/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"