Files
literate-dotfiles/scripts/install-main.sh
T
2026-04-15 15:08:14 +02:00

180 lines
4.0 KiB
Bash
Executable File

#!/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 \
bash bash-completion zsh \
kitty \
tmux
echo "==> Fonts"
paru -S --needed \
ttf-hack-nerd \
ttf-sourcecodepro-nerd \
adobe-source-code-pro-fonts \
noto-fonts-emoji
echo "==> Text Editors"
paru -S --needed \
neovim python-pynvim nodejs-neovim \
emacs \
aspell aspell-en aspell-fr
echo "==> GnuPG and Pass"
paru -S --needed \
gnupg gnome-keyring \
pass rofi-pass pass-git-helper
echo "==> Window Manager and Desktop"
paru -S --needed \
i3-wm \
sxhkd \
polybar \
picom \
dunst \
rofi rofi-calc dmenu \
xautocfg \
xorg-xrandr arandr
echo "==> File Manager"
paru -S --needed yazi
echo "==> Terminal Utilities"
paru -S --needed \
fd ripgrep fzf \
xclip xsel \
atool unzip \
trash-cli \
man-db \
fastfetch
echo "==> Browser"
paru -S --needed \
qutebrowser python-adblock pdfjs \
firefox-developer-edition passff-host
echo "==> Media"
paru -S --needed \
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 \
pipewire pipewire-alsa pipewire-audio pipewire-jack pipewire-pulse \
wireplumber \
pwvucontrol
echo "==> PDF and Image Utilities"
paru -S --needed \
pdf2svg qpdf pdfarranger \
imagemagick \
maim flameshot \
unclutter \
poppler
echo "==> Office"
paru -S --needed \
onlyoffice-bin \
libreoffice-fresh libreoffice-fresh-fr \
inkscape
echo "==> System Utilities"
paru -S --needed \
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 \
xwallpaper \
highlight-pointer-git \
mpd
setup_ssh_key() {
local key_name="$1"
local remote_host="$2"
local remote_port="${3:-22}"
local key_file="$HOME/.ssh/id_ed25519_${key_name}"
echo ""
echo "==> Setting up SSH key for ${key_name}"
# Generate key if it doesn't exist
if [ ! -f "${key_file}" ]; then
read -p "Generate new SSH key for ${key_name}? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
ssh-keygen -t ed25519 -C "${key_name}-tunnel" -f "${key_file}" -N ""
else
echo "Skipping ${key_name} key generation"
return 1
fi
fi
# Check if we can connect without password
if ssh -o BatchMode=yes -o ConnectTimeout=5 -p "${remote_port}" -i "${key_file}" "${remote_host}" exit 2>/dev/null; then
echo "SSH key for ${key_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}"
else
echo "Skipping ${key_name} key deployment"
return 1
fi
}
# Setup homelab key
setup_ssh_key "homelab" "homelab" 22
HOMELAB_OK=$?
# Setup ESRF key
setup_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