#!/bin/bash set -euo pipefail DOTFILES="${HOME}/.config/literate-dotfiles" tangle() { emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")" } echo "==> Shell and Terminal" paru -S --needed --noconfirm \ bash bash-completion zsh \ kitty \ tmux echo "==> Fonts" paru -S --needed --noconfirm \ ttf-hack-nerd \ ttf-sourcecodepro-nerd \ adobe-source-code-pro-fonts \ noto-fonts-emoji echo "==> Text Editors" paru -S --needed --noconfirm \ neovim python-pynvim nodejs-neovim \ emacs \ aspell aspell-en aspell-fr echo "==> GnuPG and Pass" paru -S --needed --noconfirm \ gnupg gnome-keyring \ pass rofi-pass pass-git-helper echo "==> Window Manager and Desktop" paru -S --needed --noconfirm \ i3-wm \ sxhkd \ polybar \ picom \ dunst \ rofi rofi-calc dmenu \ xautocfg \ xorg-xrandr arandr echo "==> File Manager" paru -S --needed --noconfirm yazi echo "==> Terminal Utilities" paru -S --needed --noconfirm \ fd ripgrep fzf \ xclip xsel \ atool unzip \ trash-cli \ man-db \ fastfetch echo "==> Browser" paru -S --needed --noconfirm \ qutebrowser python-adblock pdfjs \ firefox-developer-edition passff-host echo "==> Media" paru -S --needed --noconfirm \ mpv \ jellyfin-tui \ nsxiv \ tesseract tesseract-data-eng tesseract-data-fra tesseract-data-osd \ zathura zathura-pdf-mupdf zathura-djvu zathura-ps zathura-cb \ pdfpc \ gst-plugins-ugly gst-plugins-good gst-plugins-base-libs gst-plugins-base gst-plugins-bad gst-libav echo "==> PipeWire" paru -S --needed --noconfirm \ pipewire pipewire-alsa pipewire-audio pipewire-jack pipewire-pulse \ wireplumber echo "==> PDF and Image Utilities" paru -S --needed --noconfirm \ pdf2svg qpdf pdfarranger \ imagemagick \ maim flameshot \ unclutter \ poppler echo "==> Office" paru -S --needed --noconfirm \ onlyoffice-bin \ libreoffice-fresh libreoffice-fresh-fr \ inkscape echo "==> System Utilities" paru -S --needed --noconfirm \ udiskie \ blueman \ sshfs \ xwallpaper \ sof-firmware \ usbutils \ xautolock \ npm \ xorg-xkill \ syncthing \ wireguard-tools \ gotify-dunst-git \ gomuks \ yt-dlp \ python ipython python-pip echo "==> Misc Utilities" paru -S --needed --noconfirm \ xwallpaper \ highlight-pointer-git \ mpd KEY_FILE="$HOME/.ssh/id_ed25519" HOMELAB_OK=1 ESRF_OK=1 # Generate main SSH key if it doesn't exist if [ ! -f "${KEY_FILE}" ]; then echo "" echo "==> Generating main SSH key" read -p "Generate new SSH key at ${KEY_FILE}? [y/N] " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then ssh-keygen -t ed25519 -C "thomas@$(hostname)" -f "${KEY_FILE}" -N "" else echo "Skipping SSH key generation" fi fi # Deploy key to a remote host if needed deploy_ssh_key() { local host_name="$1" local remote_host="$2" local remote_port="${3:-22}" echo "" echo "==> Checking SSH key for ${host_name}" # Check if we can connect without password if ssh -o BatchMode=yes -o ConnectTimeout=5 -p "${remote_port}" "${remote_host}" exit 2>/dev/null; then echo "SSH key for ${host_name} is already deployed ✓" return 0 fi # Prompt to deploy key read -p "Deploy SSH key to ${remote_host}? [y/N] " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then ssh-copy-id -i "${KEY_FILE}.pub" -p "${remote_port}" "${remote_host}" return 0 else echo "Skipping ${host_name} key deployment" return 1 fi } # Setup homelab deploy_ssh_key "homelab" "homelab" 22 HOMELAB_OK=$? # Setup ESRF deploy_ssh_key "esrf" "dehaeze@firewall.esrf.fr" 8022 ESRF_OK=$? echo "==> Tangling systemd configs" tangle "systemd.org" echo "==> Enabling systemd services" if [ $HOMELAB_OK -eq 0 ]; then systemctl --user enable --now homelab-tunnel else echo " Skipping homelab-tunnel (SSH key not configured)" fi if [ $ESRF_OK -eq 0 ]; then systemctl --user enable --now esrf-tunnel else echo " Skipping esrf-tunnel (SSH key not configured)" fi systemctl --user enable --now syncthing