Files
moonarch/scripts/post-install.sh
T
nevaforget 33d1cf017f fix(theme): install the GTK theme at all, and make it Mocha
Two defects, found while porting moonix's switch back.

Nothing installed a GTK theme. settings.ini named
Colloid-Grey-Dark-Catppuccin and the PKGBUILD symlinked
/usr/share/themes/Colloid-Grey-Dark-Catppuccin/gtk-4.0/ into /etc/xdg, but
no package in either list ships it: colloid-catppuccin-theme-git is a split
package of colloid-icon-theme-git running `install.sh -s catppuccin`, which
installs icons only, and kvantum-theme-catppuccin-git is Qt. A fresh
install got Adwaita and three dangling symlinks. post-install.sh already
had the error branch for this — "GTK4 theme not found … libadwaita apps
will use fallback theme" — firing on every fresh machine.

The package name is what hid it: colloid-catppuccin-theme-git reads like a
GTK theme and is an icon set. aur.txt now says so in a comment, and the
icon entry stays — there is no Mocha icon counterpart and none is needed.

The theme was also never Mocha. Colloid's catppuccin tweak produces Frappé
with a grey accent (base #292c3c, selection #ccd0da); #1e1e2e and #b4befe
appear nowhere in its gtk.css. Kvantum, Zed and the lock screen were all
Mocha, so GTK was the one layer out of step, unnoticed because the two dark
bases sit close together.

catppuccin-gtk-theme-mocha is maintained by Catppuccin itself and ships the
upstream 1.0.3 release zips. No change in shape: their GTK theme is
Colloid, carried as a git submodule and recolored, so widget shapes and
spacing are exactly what they were.

The name will not match moonix, ever. Arch installs the release zips, whose
directories carry the full build name including the +default tweak marker;
nixpkgs builds the same 1.0.3 from source without tweaks and drops the
suffix. moonix therefore keeps rewriting this one value when it deploys
settings.ini — a permanent difference now, not a migration step.
2026-09-12 02:25:00 +02:00

216 lines
6.6 KiB
Bash
Executable File

#!/bin/bash
# ABOUTME: Post-install script for Moonarch — installs moonarch-git package and configures the system.
# ABOUTME: Run as regular user after the archinstall base installation.
set -euo pipefail
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib.sh"
# --- Prerequisites ---
check_not_root
check_pacman
# --- Install paru (AUR Helper) ---
if ! command -v paru &>/dev/null; then
log "Installing paru build dependencies..."
sudo pacman -S --needed --noconfirm base-devel rust
log "Installing paru..."
PARU_TMPDIR=$(mktemp -d)
trap 'rm -rf "$PARU_TMPDIR"' EXIT
git clone https://aur.archlinux.org/paru.git "$PARU_TMPDIR/paru"
(cd "$PARU_TMPDIR/paru" && makepkg -si --noconfirm)
rm -rf "$PARU_TMPDIR"
trap - EXIT
else
log "paru already installed."
fi
# --- Set up Moonarch package registry ---
log "Setting up Moonarch package registry..."
if ! grep -q '\[moonarch\]' /etc/pacman.conf 2>/dev/null; then
sudo tee -a /etc/pacman.conf > /dev/null <<'EOCONF'
[moonarch]
SigLevel = Required DatabaseOptional
Server = https://gitea.moonarch.de/api/packages/nevaforget/arch/$repo/$arch
EOCONF
log " + Moonarch repo added to pacman.conf."
else
log " ~ Moonarch repo already in pacman.conf."
fi
log "Importing Moonarch registry signing key..."
EXPECTED_FINGERPRINT="9B02C596A4652C40CA768E75B90C8B82EA30A131"
KEY_FILE=$(mktemp)
trap 'rm -f "$KEY_FILE"' EXIT
curl -sf https://gitea.moonarch.de/api/packages/nevaforget/arch/repository.key -o "$KEY_FILE"
if [[ ! -s "$KEY_FILE" ]]; then
err "Failed to download registry key (empty response)."
exit 1
fi
KEY_FPR=$(gpg --show-keys --with-colons "$KEY_FILE" 2>/dev/null | awk -F: '/^fpr/{print $10; exit}')
if [[ "$KEY_FPR" != "$EXPECTED_FINGERPRINT" ]]; then
err "Registry key fingerprint mismatch! Expected $EXPECTED_FINGERPRINT, got ${KEY_FPR:-<empty>}"
exit 1
fi
KEY_ID=$(gpg --show-keys --with-colons "$KEY_FILE" 2>/dev/null | awk -F: '/^pub/{print $5}')
if [[ -n "$KEY_ID" ]] && ! sudo pacman-key --list-keys "$KEY_ID" &>/dev/null; then
sudo pacman-key --add "$KEY_FILE"
sudo pacman-key --lsign-key "$KEY_ID"
log " + Registry key $KEY_ID imported and locally signed."
else
log " ~ Registry key already imported."
fi
rm -f "$KEY_FILE"
trap - EXIT
# --- Install moonarch-git from the Arch registry ---
log "Installing moonarch-git package..."
sudo pacman -Sy --noconfirm
paru -S --needed --noconfirm moonarch-git
# --- Install AUR extras (cannot be hard depends of moonarch-git) ---
if [[ -f "$AUR_PACKAGES" ]]; then
log "Installing AUR packages from $AUR_PACKAGES..."
# shellcheck disable=SC2046
paru -S --needed --noconfirm $(read_packages "$AUR_PACKAGES")
else
err "AUR package list not found: $AUR_PACKAGES"
exit 1
fi
# --- User-level GTK4 symlinks for libadwaita apps ---
THEME_NAME="catppuccin-mocha-lavender-standard+default"
THEME_GTK4="/usr/share/themes/$THEME_NAME/gtk-4.0"
if [[ -d "$THEME_GTK4" ]]; then
log "Creating user-level GTK4 symlinks for $THEME_NAME..."
USER_GTK4="$HOME/.config/gtk-4.0"
mkdir -p "$USER_GTK4"
ln -sf "$THEME_GTK4/gtk-dark.css" "$USER_GTK4/gtk.css"
ln -sf "$THEME_GTK4/gtk-dark.css" "$USER_GTK4/gtk-dark.css"
rm -f "$USER_GTK4/assets"
ln -s "$THEME_GTK4/assets" "$USER_GTK4/assets"
else
err "GTK4 theme not found: $THEME_GTK4 — libadwaita apps will use fallback theme."
fi
# --- gsettings for GTK theme and dark mode ---
log "Setting gsettings for GTK theme..."
gsettings set org.gnome.desktop.interface gtk-theme "$THEME_NAME"
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
gsettings set org.gnome.desktop.interface icon-theme 'Colloid-Grey-Catppuccin-Dark'
gsettings set org.gnome.desktop.interface font-name 'UbuntuSans Nerd Font 11'
# --- Zsh user config ---
if [[ ! -f "$HOME/.zshrc" ]]; then
log "No ~/.zshrc found — sourcing Moonarch defaults."
echo "source /etc/zsh/zshrc.moonarch" > "$HOME/.zshrc"
fi
# --- Seed Stasis user config ---
#
# Stasis reads ~/.config/stasis/stasis.rune (or /etc/stasis/stasis.rune as
# fallback) but never /etc/xdg/. Without a user config it writes its own
# upstream default on first start. Seed Moonarch's template so the bootstrap
# sees an existing file and skips. Never overwrite an existing user config.
if [[ ! -f "$HOME/.config/stasis/stasis.rune" && -f /etc/xdg/stasis/stasis.rune ]]; then
log "Seeding Moonarch stasis config to user home."
install -Dm644 /etc/xdg/stasis/stasis.rune "$HOME/.config/stasis/stasis.rune"
fi
# --- Enable systemd user services ---
log "Enabling systemd user services..."
USER_SERVICES=(
"kanshi"
"stasis"
"wayland-pipewire-idle-inhibit"
"cliphist-text"
"cliphist-image"
)
# wlsunset deliberately excluded: nightlight is a user-toggle (off by default).
# Enabling it system-wide would create a global-scope WantedBy symlink that
# overrides any user-scope `systemctl --user disable`.
for service in "${USER_SERVICES[@]}"; do
if systemctl --user cat "${service}.service" &>/dev/null; then
systemctl --user enable "$service"
log " + $service (user)"
else
log " ~ $service (user) not found, skipped."
fi
done
# --- Enable systemd services ---
log "Enabling services..."
SERVICES=(
"NetworkManager"
"bluetooth"
"greetd"
"systemd-timesyncd"
"ufw"
"power-profiles-daemon"
)
for service in "${SERVICES[@]}"; do
if systemctl list-unit-files "${service}.service" &>/dev/null; then
sudo systemctl enable "$service"
log " + $service"
else
log " ~ $service not found, skipped."
fi
done
# --- Set shell to zsh ---
if [[ "$SHELL" != */zsh ]]; then
log "Setting default shell to zsh..."
chsh -s "$(which zsh)"
fi
# --- Enable firewall ---
log "Configuring UFW..."
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw --force enable
# --- Boot parameters: add quiet to systemd-boot entries ---
log "Configuring boot parameters..."
for entry in /boot/loader/entries/*.conf; do
if [[ -f "$entry" ]] && [[ "$(basename "$entry")" != *fallback* ]] && ! grep -q 'quiet' "$entry"; then
sudo sed -i '/^options/ s/$/ quiet/' "$entry"
log " + $(basename "$entry") — quiet added"
fi
done
# --- Screenshots directory ---
mkdir -p "$HOME/Pictures/Screenshots"
mkdir -p "$HOME/Pictures/Wallpaper"
# --- Done ---
log ""
log "============================================"
log " Moonarch installation complete!"
log "============================================"
log ""
log "Next steps:"
log " 1. Reboot"
log " 2. Place wallpapers in ~/Pictures/Wallpaper/"
log " 3. User overrides in ~/.config/"
log ""