2024-11-13 21:50:35 +07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Step 1: Generate a random 8-character alphanumeric password
|
|
|
|
PASSWORD=$(openssl rand -base64 6 | tr -dc 'A-Za-z0-9' | head -c 8)
|
|
|
|
|
|
|
|
# Step 2: Write the password to password.txt
|
|
|
|
echo "$PASSWORD" > password.txt
|
|
|
|
echo "Password saved to password.txt."
|
|
|
|
|
|
|
|
# Step 3: Echo the password to the terminal
|
|
|
|
echo "The generated password is: $PASSWORD"
|
|
|
|
|
|
|
|
# Step 4: Install Nix
|
|
|
|
echo "Installing Nix package manager..."
|
2024-11-13 21:56:36 +07:00
|
|
|
curl -L https://nixos.org/nix/install | sh -s -- --daemon
|
2024-11-13 21:50:35 +07:00
|
|
|
. ~/.nix-profile/etc/profile.d/nix.sh
|
|
|
|
|
|
|
|
# Step 5: Enable Flakes
|
|
|
|
echo "Enabling Flakes in Nix configuration..."
|
|
|
|
mkdir -p ~/.config/nix
|
|
|
|
echo "experimental-features = nix-command flakes" | tee -a ~/.config/nix/nix.conf
|
|
|
|
|
|
|
|
# Step 6: Install Home Manager
|
|
|
|
echo "Installing Home Manager..."
|
|
|
|
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
|
|
|
|
nix-channel --update
|
|
|
|
nix-shell '<home-manager>' -A install
|
|
|
|
|
|
|
|
# Step 7: Run the Nix Flake to install and configure XFCE, XRDP, etc.
|
|
|
|
echo "Setting up environment with Nix Flake and Home Manager..."
|
|
|
|
nix develop
|
|
|
|
home-manager switch --flake .#gabriel
|
|
|
|
|
|
|
|
echo "Setup complete! XFCE, XRDP, and environment configurations applied."
|