Fixed install.sh

This commit is contained in:
2025-01-18 02:42:21 -08:00
parent 22db4be6fa
commit aea284a05d

View File

@@ -1,39 +1,4 @@
!#/bin/bash
read -p "Do you want to create a new sudo user? (yes/no): " response
response=$(echo "$response" | tr '[:upper:]' '[:lower:]')
if [[ "$response" == "yes" || "$response" == "y" ]]; then
read -p "Enter the username for the new sudo user: " username
# Check if the username already exists
if id "$username" &>/dev/null; then
echo "User '$username' already exists."
exit 1
fi
# Create the new user using adduser
sudo adduser "$username"
if [[ $? -ne 0 ]]; then
echo "Failed to create user '$username'."
exit 1
fi
# Add the user to the sudo group
sudo usermod -aG sudo "$username"
if [[ $? -eq 0 ]]; then
echo "User '$username' has been added to the sudo group."
else
echo "Failed to add '$username' to the sudo group."
exit 1
fi
echo "New sudo user '$username' has been created successfully."
else
echo "No user was created."
fi
echo "Intalling nix and home-manager"
sh <(curl -L https://nixos.org/nix/install) --no-daemon
@@ -55,6 +20,8 @@ home-manager switch
sudo echo "/home/$USER/.nix-profile/bin/zsh" | sudo tee -a /etc/shells
. ~/.nix-profile/etc/profile.d/nix.sh
chsh -s /home/$USER/.nix-profile/bin/zsh $USER
source ~/.zshrc