phoebus_os/installer/lib/desktop.sh
Phoebus 38214ea9e7 chore: import Phoebus OS installer and Rust migration
Initial public import of the proven Bash installer (installer/) and the production Rust workspace (installer-rs/). The reference ISO, build output and local agent transcripts are gitignored.

Verified: installer/tests/run_tests.sh and cargo test --workspace both pass.
2026-09-20 02:07:33 -07:00

93 lines
2.6 KiB
Bash

#!/usr/bin/env bash
# shellcheck shell=bash
#
# Desktop profile installation.
#
# The flagship desktop is a small Wayland tiling environment centred on dwl.
# Full desktop installation is future work; this module defines the profile and
# the package sets so the installer can grow into it cleanly.
desktop_profiles() {
printf '%s\n' none minimal dwl full
}
# desktop_packages PROFILE
desktop_packages() {
local profile="$1"
case "$profile" in
none)
;;
minimal)
printf '%s\n' \
gui-libs/wayland \
gui-libs/wayland-protocols \
x11-base/xwayland
;;
dwl|full)
printf '%s\n' \
gui-wm/dwl \
gui-apps/waybar \
gui-apps/wofi \
gui-apps/mako \
gui-apps/swayidle \
gui-apps/swaylock \
gui-apps/swaybg \
gui-apps/wl-clipboard \
gui-apps/grim \
gui-apps/slurp \
gui-libs/gtk-layer-shell \
x11-base/xwayland \
x11-terms/kitty \
net-misc/networkmanager \
sys-auth/polkit \
gnome-extra/polkit-gnome
;;
esac
if [[ "$profile" == "full" ]]; then
printf '%s\n' \
sys-apps/flatpak \
net-wireless/bluez \
gnome-base/gnome-keyring
fi
}
# desktop_audio_packages - PipeWire is always the audio stack
desktop_audio_packages() {
printf '%s\n' media-video/pipewire media-video/wireplumber
}
# desktop_install ROOT
desktop_install() {
local root="$1" profile
profile="$(config_get DESKTOP_PROFILE)"
[[ "$profile" == "none" ]] && { log_info "no desktop profile selected"; return 0; }
local -a packages=()
mapfile -t packages < <(desktop_packages "$profile")
mapfile -t -O "${#packages[@]}" packages < <(desktop_audio_packages)
if config_bool FLATPAK; then
packages+=(sys-apps/flatpak)
fi
log_info "installing desktop profile '$profile' (${#packages[@]} packages)"
portage_emerge "$root" "${packages[@]}"
}
# desktop_configure_flatpak ROOT
desktop_configure_flatpak() {
local root="$1"
config_bool FLATPAK || return 0
# Flathub is a third-party catalogue; adding it is opt-in via the profile.
portage_chroot "$root" flatpak remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo || {
log_warn "could not add flathub remote (network?)"; return 0; }
log_info "flatpak configured with flathub"
}
# desktop_services ROOT - system services needed by the desktop
desktop_services() {
local profile
profile="$(config_get DESKTOP_PROFILE)"
printf '%s\n' NetworkManager systemd-resolved
[[ "$profile" == "full" ]] && printf '%s\n' bluetooth
return 0
}