feat(tools): seed guest state at boot so captures render wallpapers (item 28c)
All checks were successful
Check / eval (push) Successful in 3m8s

theme-shot guests had no ~/.nomarchy, so the session's exec-once
`nomarchy-theme-sync wallpaper` died on missing state and captures
showed a bare base-color backdrop. Seed theme-state.json via tmpfiles
before greetd starts the session — the real exec-once path now paints.
(A post-boot testScript seed is too late for exec-once, and a manual
re-run fails without WAYLAND_DISPLAY: awww's client socket is
display-named.)

V2: summer-night capture renders wallpaper + inverted cream bar +
menu + placeholder dim, all coherent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-05 22:09:52 +01:00
parent 01ee847490
commit 39cfe0fb12
3 changed files with 44 additions and 12 deletions

View File

@@ -4,10 +4,11 @@
# Maintainer tool, NOT a checks.* gate (a full-desktop VM is far too
# heavy for CI). Impure: THEME env picks the theme slug.
# THEME=<slug> nix build --impure -f tools/theme-shot.nix --no-link --print-out-paths
# Known gap: the wallpaper does not paint — nomarchy-theme-sync resolves
# state from ~/.nomarchy at runtime, absent in the guest; seed it
# (cp the flake to ~nomarchy/.nomarchy in testScript) if the wallpaper
# matters to the shot. Bar + menus render fully.
# The guest gets a minimal ~/.nomarchy (just the theme JSON as
# theme-state.json), seeded via tmpfiles BEFORE greetd starts the
# session, so the session's own exec-once wallpaper paint works —
# assets come from the themesDir baked into the tool. Bar, menus AND
# wallpaper render.
let
flake = builtins.getFlake ("git+file://" + toString ../.);
inherit (flake.inputs) nixpkgs home-manager;
@@ -38,6 +39,14 @@ pkgs.testers.runNixOSTest {
extraGroups = [ "wheel" "video" ];
};
nomarchy.system.stateFile = flake + "/themes/${slug}.json";
# Seed the runtime state (theme-sync reads $NOMARCHY_PATH, default
# ~/.nomarchy) before greetd auto-starts the session, so the
# exec-once `nomarchy-theme-sync wallpaper` finds it and paints.
# NixOS activation creates /home/nomarchy before systemd runs.
systemd.tmpfiles.rules = [
"d /home/nomarchy/.nomarchy 0755 nomarchy users -"
"C /home/nomarchy/.nomarchy/theme-state.json 0644 nomarchy users - ${flake + "/themes/${slug}.json"}"
];
services.greetd.settings.initial_session = {
command = "start-hyprland";
user = "nomarchy";
@@ -52,10 +61,9 @@ pkgs.testers.runNixOSTest {
testScript = ''
machine.wait_for_unit("multi-user.target")
machine.wait_for_file("/run/user/1000/hypr", 180)
machine.sleep(12)
# Paint the wallpaper explicitly (awww timing was flaky in the spike).
machine.execute("su - nomarchy -c 'XDG_RUNTIME_DIR=/run/user/1000 nomarchy-theme-sync wallpaper' >/dev/null 2>&1")
machine.sleep(18)
# The session exec-once paints the wallpaper (softGL first paint at
# 1920x1080 is slow) give it a generous settle.
machine.sleep(30)
machine.screenshot("desktop")
# Open the root menu for the polish review.
hy = "su - nomarchy -c 'XDG_RUNTIME_DIR=/run/user/1000 HYPRLAND_INSTANCE_SIGNATURE=$(ls /run/user/1000/hypr | head -1) hyprctl dispatch exec"