shell: use DEVSHELL_ROOT

This commit is contained in:
Timothy DeHerrera 2021-01-25 09:23:51 -07:00
parent b1c42e4ed4
commit a1fade8411
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122

View file

@ -14,21 +14,21 @@ let
if [[ -z "$1" ]]; then
echo "Usage: $(basename "$0") [ iso | up | install {host} | {host} [switch|boot|test] ]"
elif [[ "$1" == "up" ]]; then
mkdir -p up
mkdir -p $DEVSHELL_ROOT/up
hostname=$(hostname)
nixos-generate-config --dir up/$hostname
nixos-generate-config --dir $DEVSHELL_ROOT/up/$hostname
echo \
"{
imports = [ ../up/$hostname/configuration.nix ];
}" > hosts/up-$hostname.nix
git add -f up/$hostname
git add -f hosts/up-$hostname.nix
}" > $DEVSHELL_ROOT/hosts/up-$hostname.nix
git add -f $DEVSHELL_ROOT/up/$hostname
git add -f $DEVSHELL_ROOT/hosts/up-$hostname.nix
elif [[ "$1" == "iso" ]]; then
nix build $DEVSHELL_ROOT#nixosConfigurations.niximg.${build}.isoImage "${"\${@:2}"}"
elif [[ "$1" == "install" ]]; then
sudo nixos-install --flake ".#$2" "${"\${@:3}"}"
sudo nixos-install --flake "$DEVSHELL_ROOT#$2" "${"\${@:3}"}"
else
sudo nixos-rebuild --flake ".#$1" "${"\${@:2}"}"
sudo nixos-rebuild --flake "$DEVSHELL_ROOT#$1" "${"\${@:2}"}"
fi
'';