Added username replacement #1

Merged
rogueking merged 1 commits from devlopment into main 2025-01-29 16:43:38 -08:00
2 changed files with 26 additions and 7 deletions

View File

@@ -65,8 +65,6 @@
'';
};
zoxide = {
enable = true;
enableZshIntegration = true;

View File

@@ -1,17 +1,42 @@
!#/bin/bash
echo "Intalling nix and home-manager"
echo "You are logged in as $USER"
read -p "Is this the target user? Y/N: " response
case "$response" in
[Yy]* ) echo "Proceeding...";;
[Nn]* ) echo "Exiting..."; exit 1;;
* ) echo "Invalid input. Please enter Y or N."; exit 1;;
esac
echo "Intalling nix"
sh <(curl -L https://nixos.org/nix/install) --no-daemon
echo "Installing flakes"
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >>~/.config/nix/nix.conf
. ~/.nix-profile/etc/profile.d/nix.sh
echo "Installing home-manager"
nix-channel --add https://nixos.org/channels/nixos-24.11 nixpkgs
nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz home-manager
nix-channel --update
replacement_word="$USER"
files=("home.nix" "cli-tools.nix")
for file in "${files[@]}"; do
if [ -f "$file" ]; then
# Use sed to replace 'USER' with the replacement word
sed -i "s/USER/$replacement_word/g" "$file"
echo "Processed: $file"
else
echo "Error: $file does not exist or is not a regular file."
fi
done
nix-shell '<home-manager>' -A install
cp -r home-manager/ ~/.config/
@@ -25,7 +50,3 @@ sudo echo "/home/$USER/.nix-profile/bin/zsh" | sudo tee -a /etc/shells
chsh -s /home/$USER/.nix-profile/bin/zsh $USER
source ~/.zshrc
#sudo echo ". ~/.nix-profile/etc/profile.d/nix.sh" | sudo tee -a ~/.bashrc
#sudo echo "zsh" | sudo tee -a ~/.bashrc