nixfiles/scripts/setup.sh
2024-03-16 12:21:25 +00:00

34 lines
819 B
Bash
Executable file

#!/bin/sh
echo "Select a machine:"
select machine in machines/*; do
if [ -n "$machine" ]; then
break
else
echo "Invalid selection."
fi
done
sudo mv /etc/nixos /etc/nixos.bak
sudo mkdir /etc/nixos
sudo ln -s "$(pwd)/$machine/*" /etc/nixos
read -p "Do you want to symlink home-manager? (y/n): " symlinkHomeManager
if [ "$symlinkHomeManager" = "y" ] || [ "$symlinkHomeManager" = "Y" ]; then
echo -e "\nSelect a home manager configuration:"
select config in home-manager/*; do
if [ -n "$config" ]; then
break
else
echo "Invalid selection."
fi
done
mv ~/.config/home-manager ~/.config/home-manager.bak
ln -s "$(pwd)/$config" ~/.config/home-manager
else
echo "Skipped symlink for home-manager"
fi
echo "Task completed successfully."