From 9432bc4831826ef65fcebe51d2a7898947a59692 Mon Sep 17 00:00:00 2001 From: nevaforget Date: Wed, 22 Apr 2026 08:49:04 +0200 Subject: [PATCH] fix(post-install): seed stasis config into user home Stasis ignores /etc/xdg/ and only reads ~/.config/stasis/stasis.rune (primary) or /etc/stasis/stasis.rune (fallback). On first start with no user config it writes its own hardcoded default, so Moonarch's tuned idle plans were never active on fresh installs. Seed the template from /etc/xdg/stasis/stasis.rune into the user home before stasis ever starts, only if the user file is missing. See DECISIONS.md for verification against upstream v1.1.0. --- DECISIONS.md | 6 ++++++ scripts/post-install.sh | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/DECISIONS.md b/DECISIONS.md index 7474fb0..d3708c3 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -1,5 +1,11 @@ # Decisions +## 2026-04-22 – Seed Stasis user config from post-install.sh +- **Who**: Dominik, ClaudeCode +- **Why**: Moonarch shipped `defaults/xdg/stasis/stasis.rune` (deployed to `/etc/xdg/stasis/stasis.rune` by the PKGBUILD) on the assumption that stasis honors the XDG system config hierarchy. It does not. Verified against upstream source (v1.1.0, `src/config/mod.rs:30` + `src/config/bootstrap.rs`): stasis only reads `~/.config/stasis/stasis.rune` (primary) or `/etc/stasis/stasis.rune` (fallback, no `xdg/`). On every start with no user config, `ensure_user_config_exists()` writes its own hardcoded default (laptop/desktop template compiled into the binary) to `~/.config/stasis/stasis.rune`. Net effect: Moonarch's Idle-Manager tuning (AC/battery plans, moonlock integration, inhibit apps, niri DPMS commands) was never active on fresh installs — users got the upstream defaults with `swaylock` as locker. +- **Tradeoffs**: Three options were considered. (A) Service drop-in with `--config /etc/stasis/stasis.rune` — cleanest, upgrades propagate via package, no user-home touching; rejected because it takes stasis out of the standard config path users expect when they want to customize, and requires packaging a drop-in unit. (B) Seed once from post-install.sh into `~/.config/stasis/stasis.rune` — chosen: user-owned file, immediately editable, no magic. Cost: package updates to the template never reach users who already ran post-install; they have to merge manually. (C) Recurring systemd user service that keeps seeding — ruled out, too clever, user edits would race with it. Stasis has no config hierarchy / merging, so "system default + user override" cannot be modeled at all. +- **How**: Added a block to `scripts/post-install.sh` before the user-services-enable step: if `~/.config/stasis/stasis.rune` does not exist and `/etc/xdg/stasis/stasis.rune` does, `install -Dm644` copies the template into the user home. Order is correct — moonarch-git is installed earlier in the script (deploys `/etc/xdg/…`), and stasis.service is only *enabled* (not started) later, so the seed is in place before stasis ever runs. The `/etc/xdg/stasis/` payload stays as the canonical template source inside the package. + ## 2026-04-21 – post-install.sh pulls aur.txt, rust for paru build, rustup out of official - **Who**: Dominik, ClaudeCode - **Why**: Three related gaps uncovered while fixing the paru bootstrap: (1) `moonarch-git` cannot depend on AUR packages, so every AUR package in `aur.txt` (walker-bin, elephant-*-bin, awww's theme, waypaper, stasis, …) was silently never installed by post-install.sh — a fresh install would have a working pacman but no launcher, no idle manager, no theming. (2) `makepkg -si` for `paru` (AUR source build) needs `rust` as makedep; neither archinstall nor post-install.sh installed it, so the restored paru bootstrap would have crashed on rust-less systems. (3) `rustup` sat in `official.txt` "for something we don't remember" — turned out to be a leftover; `rust` suffices for the paru build, and rustup is only needed for dev toolchain management which is a per-user concern, not a Moonarch default. diff --git a/scripts/post-install.sh b/scripts/post-install.sh index 9f69e3e..eb0475b 100755 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -119,6 +119,17 @@ if [[ ! -f "$HOME/.zshrc" ]]; then 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..."