Add fancy selection menu to install bash app

This commit is contained in:
Lillian Violet 2024-02-28 11:01:48 +01:00
parent 69898664d4
commit 6af277d0af

View file

@ -12,16 +12,20 @@ writeShellApplication
text = '' text = ''
# An install script for NixOS installation to /tmp # An install script for NixOS installation to /tmp
set -e set -e
hostname=$1
if [[ "$1" == "" ]]; then
echo "No hostname given, please specify a hostname"
exit 2
fi
pushd /tmp pushd /tmp
git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./install git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./install
pushd ./install/nixos/hosts
echo "Please choose the hostname you are installing to from the following list:"
i=1
for d in */
do
dirs[i++]="$\{d%/}"
done
select dir in "$\{dirs[@]}"; do echo "you selected $\{dir}"; break; done
popd
pushd ./install pushd ./install
echo "NixOS Installing..." echo "NixOS Installing..."
sudo nixos-install --flake .#$1 sudo nixos-install --flake .#$dir
popd popd
echo "Cleaning up repository in tmp..." echo "Cleaning up repository in tmp..."
rm -rf ./install rm -rf ./install