| 1 | #!/bin/env bash |
| 2 | |
| 3 | pkg_utils=( |
| 4 | "fd" |
| 5 | "ffmpegthumbnailer" |
| 6 | "foot" |
| 7 | "fuzzel" |
| 8 | "fzf" |
| 9 | "gammastep" |
| 10 | "ghostscript" |
| 11 | "gobject-introspection" |
| 12 | "gparted" |
| 13 | "grub" |
| 14 | "gvfs" |
| 15 | "gvfs-mtp" |
| 16 | "imagemagick" |
| 17 | "imlib2" |
| 18 | "jq" |
| 19 | "kanshi" |
| 20 | "lf" |
| 21 | "libnotify" |
| 22 | "libreoffice-fresh" |
| 23 | "lua" |
| 24 | "lvm2" |
| 25 | "man-db" |
| 26 | "meson" |
| 27 | "mpc" |
| 28 | "mpd" |
| 29 | "mpd-mpris" |
| 30 | "mpv" |
| 31 | "ncdu" |
| 32 | "ncmpcpp" |
| 33 | "ntfs-3g" |
| 34 | "nwg-look" |
| 35 | "pacman-contrib" |
| 36 | "pamixer" |
| 37 | "pavucontrol" |
| 38 | "pcmanfm" |
| 39 | "pipewire" |
| 40 | "pipewire-pulse" |
| 41 | "progress" |
| 42 | "python-gobject" |
| 43 | "python-pip" |
| 44 | "python-virtualenv" |
| 45 | "qpdf" |
| 46 | "reflector" |
| 47 | "ripgrep" |
| 48 | "rsync" |
| 49 | "sshfs" |
| 50 | "stow" |
| 51 | "tesseract" |
| 52 | "torbrowser-launcher" |
| 53 | "transmission-cli" |
| 54 | "noto-fonts" |
| 55 | "noto-fonts-cjk" |
| 56 | "noto-fonts-emoji" |
| 57 | "ttf-jetbrains-mono-nerd" |
| 58 | "tree" |
| 59 | "unzip" |
| 60 | "waybar" |
| 61 | "wget" |
| 62 | "woff2-font-awesome" |
| 63 | "wtype" |
| 64 | "xarchiver" |
| 65 | "xdg-user-dirs" |
| 66 | "yt-dlp" |
| 67 | "zathura" |
| 68 | "zathura-pdf-mupdf" |
| 69 | "zip" |
| 70 | "zola" |
| 71 | "zsh" |
| 72 | "zsh-autosuggestions" |
| 73 | ) |
| 74 | |
| 75 | pkg_dev_tools=( |
| 76 | "git" |
| 77 | "neovim" |
| 78 | "platformio-core" |
| 79 | "tmux" |
| 80 | "nodejs" |
| 81 | "lazygit" |
| 82 | ) |
| 83 | |
| 84 | pkg_optional=( |
| 85 | "keepassxc" |
| 86 | "obsidian" |
| 87 | "syncthing" |
| 88 | "newsboat" |
| 89 | "obs-studio" |
| 90 | "telegram-desktop" |
| 91 | ) |
| 92 | |
| 93 | pkg_nvidia=( |
| 94 | "nvidia" |
| 95 | "nvidia-utils" |
| 96 | ) |
| 97 | |
| 98 | pkg_desktop=( |
| 99 | "hypridle" |
| 100 | "hyprland" |
| 101 | "hyprlock" |
| 102 | "hyprpaper" |
| 103 | "hyprpicker" |
| 104 | "hyprpolkitagent" |
| 105 | "hyprshot" |
| 106 | "xdg-desktop-portal-hyprland" |
| 107 | "swaync" |
| 108 | "waybar" |
| 109 | ) |
| 110 | |
| 111 | pkg_aur=( |
| 112 | "envycontrol" |
| 113 | "htop-vim" |
| 114 | "jmtpfs" |
| 115 | "keepmenu" |
| 116 | "keyd-git" |
| 117 | "librewolf-bin" |
| 118 | "python-pywal16" |
| 119 | "tokyonight-gtk-theme-git" |
| 120 | "zsh-fast-syntax-highlighting-git" |
| 121 | ) |
| 122 | |
| 123 | |
| 124 | # Install necessary desktop packages |
| 125 | sudo pacman -S --needed "${pkg_desktop[@]}" "${pkg_utils[@]}" |
| 126 | |
| 127 | # Install dev tools |
| 128 | read -rp "Do you wish to development tools? [y/n]" install_dev_tools |
| 129 | if [[ $install_dev_tools == y ]]; then |
| 130 | sudo pacman -S --needed "${pkg_dev_tools[@]}" |
| 131 | fi |
| 132 | |
| 133 | # Install optional packages |
| 134 | read -rp "Do you wish to install optional packages? [y/n]" install_optional_pkg |
| 135 | if [[ $install_optional_pkg == y ]]; then |
| 136 | sudo pacman -S --needed "${pkg_optional[@]}" |
| 137 | fi |
| 138 | |
| 139 | # Install nvidia drivers |
| 140 | read -rp "Do you wish to install Nvidia drivers? [y/n]" install_nvidia_drivers |
| 141 | if [[ $install_nvidia_drivers == y ]]; then |
| 142 | sudo pacman -S --needed "${pkg_nvidia[@]}" |
| 143 | fi |
| 144 | |
| 145 | |
| 146 | # Install aur packages |
| 147 | read -rp "Do you wish to install aur packages? [y/n]" install_aur_pkg |
| 148 | # Install paru if it isn't already installed |
| 149 | if [[ $install_aur_pkg == y ]]; then |
| 150 | if ! command -v paru >/dev/null 2>&1; then |
| 151 | echo "Installing paru..." |
| 152 | git clone https://aur.archlinux.org/paru-bin.git |
| 153 | cd paru-bin |
| 154 | makepkg -sri |
| 155 | cd .. |
| 156 | rm -rf paru-bin |
| 157 | else |
| 158 | echo "Skipping paru (already in PATH)" |
| 159 | fi |
| 160 | # Install aur packages |
| 161 | paru -S --needed "${pkg_aur[@]}" |
| 162 | fi |
| 163 | |
| 164 | |
| 165 | # Setup dotfiles |
| 166 | echo "⚠️ WARNING: This will DELETE any conflicting files and replace them with symlinks from this repo." |
| 167 | echo " Make sure your dotfiles repo is the source of truth / already backed up." |
| 168 | read -rp "Continue with stow (y/N): " confirm |
| 169 | if [[ "$confirm" =~ ^[Yy]$ ]]; then |
| 170 | echo "Detecting conflicts..." |
| 171 | conflicts=$(stow . --no-folding -nv 2>&1 | \ |
| 172 | sed -n 's/.*existing target \(.*\) since neither.*/\1/p') |
| 173 | |
| 174 | if [[ -z "$conflicts" ]]; then |
| 175 | echo "No conflicts. Running stow normally..." |
| 176 | stow . --no-folding |
| 177 | echo "✅ Done." |
| 178 | else |
| 179 | echo "These paths conflict and will be removed:" |
| 180 | printf ' %s\n' $conflicts |
| 181 | read -rp "Proceed with deleting these files? (y/N): " ok |
| 182 | if [[ ! "$ok" =~ ^[Yy]$ ]]; then |
| 183 | echo "Aborted." |
| 184 | fi |
| 185 | |
| 186 | # Remove conflicts relative to $HOME |
| 187 | for path in $conflicts; do |
| 188 | echo "Removing $HOME/$path" |
| 189 | rm -rf "$HOME/$path" |
| 190 | done |
| 191 | |
| 192 | echo "Running stow..." |
| 193 | stow . --no-folding |
| 194 | echo "✅ Dotfiles stowed with overwrite." |
| 195 | fi |
| 196 | else |
| 197 | echo "Aborted" |
| 198 | fi |
| 199 | |
| 200 | # Setup neovim dotfiles |
| 201 | read -rp "Clone neovim dotfiles as well? (y/N): " confirm |
| 202 | if [[ "$confirm" =~ ^[Yy]$ ]]; then |
| 203 | echo "Taking backup of neovim config (if already exists)" |
| 204 | mv ~/.config/nvim{,.bak} |
| 205 | mv ~/.local/share/nvim{,.bak} |
| 206 | mv ~/.local/state/nvim{,.bak} |
| 207 | mv ~/.cache/nvim{,.bak} |
| 208 | git clone --depth=1 git@github.com:krolyxon/nvim.git ~/.config/nvim |
| 209 | fi |
| 210 | |
| 211 | # Change default shell to zsh |
| 212 | if [[ "$SHELL" != "$(which zsh)" ]]; then |
| 213 | read -rp "Change default shell to ZSH? (y/N): " confirm |
| 214 | if [[ "$confirm" =~ ^[Yy]$ ]]; then |
| 215 | echo "Changing default shell to zsh..." |
| 216 | chsh -s $(which zsh) |
| 217 | fi |
| 218 | else |
| 219 | echo "Skipping: zsh is already the default shell" |
| 220 | fi |