feat: make VM and live ISO match an installed Nomarchy

- Migrate VM and graphical ISO to home-manager.nixosModules.home-manager;
  drop the standalone-HM sudo-based activation script (ran HM against
  /root because HOME wasn't reset) in flake.nix, core/system/vm-guest.nix,
  hosts/live-iso.nix.
- Run swaybg as nomarchy-wallpaper.service instead of a silent Hyprland
  exec-once so failures surface in systemctl.
- Skip the battery monitor unit on hosts without /sys/class/power_supply/BAT*
  (VMs, desktops).
- Don't wrap walker --dmenu in uwsm-app; redirect setsid background std-fds
  in nomarchy-launch-walker so $(menu ...) in nomarchy-menu doesn't hang.
- Restart waybar/walker via systemctl --user rather than pkill + uwsm-app
  to stop the post-theme-switch color race.
- Wire nomarchy-restart-walker/-waybar into nomarchy-theme-set so themes
  that only change the imported CSS reload correctly.
- Waybar: pin #custom-nomarchy to the Nomarchy font and use the U+F000
  codepoint so the logo shows across all themes.
- Auto-install the correct icon-theme package per palette via a new
  nomarchyLib.iconThemePackage helper in lib/default.nix; Everforest now
  actually renders for summer-night.
- Pre-cache every theme's HM generation: new packages.allThemeVariants
  flake output and nomarchy-themes-prebuild script so theme switches are
  cache-only (no Stylix rebuild, no downloads).
- Add nomarchy-test-live-iso to boot the graphical ISO in QEMU the same
  way nomarchy-test-vm does, with virtio-gpu support added to live-iso.nix.
- Installer-generated home.nix/system.nix now ship a curated, commented
  app menu (btop/fastfetch/chromium on by default) plus optional system
  services (Docker, libvirtd, Tailscale, Syncthing, Flatpak, Steam).
- nomarchy-test-vm now wipes the stale nomarchy.qcow2 before launch.
- Remove obsolete GEMINI.md and PLAN.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-04-24 18:20:54 +01:00
parent 096124c04a
commit 877da19770
21 changed files with 368 additions and 148 deletions

View File

@@ -5,6 +5,9 @@
Unit = {
Description = "Nomarchy Battery Monitor Check";
After = [ "graphical-session.target" ];
# Skip on hosts with no battery (VMs, desktops) — otherwise the
# monitor script fails and degrades the user session.
ConditionPathExistsGlob = "/sys/class/power_supply/BAT*";
};
Service = {
@@ -19,6 +22,7 @@
systemd.user.timers.nomarchy-battery-monitor = {
Unit = {
Description = "Nomarchy Battery Monitor Timer";
ConditionPathExistsGlob = "/sys/class/power_supply/BAT*";
};
Timer = {

View File

@@ -3,14 +3,27 @@
# Wrapper to launch walker with elephant provider, or fallback to rofi if walker is missing.
if command -v walker >/dev/null 2>&1; then
# Ensure elephant is running before launching walker
# The setsid backgrounded commands below MUST redirect all std fds to
# /dev/null. If they inherit stdout from a $(...) caller (e.g. nomarchy-menu
# doing `$(menu ...)`), bash waits for those fds to close on every return,
# which hangs the terminal after each menu selection.
if ! pgrep -x elephant > /dev/null; then
setsid uwsm-app -- elephant &
setsid uwsm-app -- elephant </dev/null >/dev/null 2>&1 &
disown
fi
# Ensure walker service is running
if ! pgrep -f "walker --gapplication-service" > /dev/null; then
setsid uwsm-app -- walker --gapplication-service &
setsid uwsm-app -- walker --gapplication-service </dev/null >/dev/null 2>&1 &
disown
fi
# dmenu mode reads stdin and is invoked many times in quick succession
# by nomarchy-menu. Wrapping each call in uwsm-app (systemd-run --scope)
# creates a fresh transient scope per invocation, which breaks chained
# submenus — subsequent walker calls don't see a usable stdin and exit
# without showing anything. Invoke walker directly for dmenu.
if [[ "$*" == *"--dmenu"* ]]; then
exec walker "$@"
fi
exec uwsm-app -- walker --width 644 --maxheight 300 --minheight 300 "$@"

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Build the Nomarchy graphical live ISO and boot it in QEMU for a
# try-before-install experience. The ISO is the `installerIsoGraphical`
# NixOS configuration — same Nomarchy system + Home Manager stack as
# `nomarchy-test-vm`, just wrapped in an installable live medium.
set -e
echo "Building Nomarchy Live ISO..."
nix build .#nixosConfigurations.installerIsoGraphical.config.system.build.isoImage
ISO=$(ls -1 result/iso/*.iso 2>/dev/null | head -n 1)
if [ -z "$ISO" ]; then
echo "Error: ISO build succeeded but no .iso file found in result/iso/"
exit 1
fi
# Prefer UEFI with OVMF so the ISO boots the same way a modern install does.
# Fall back to BIOS if OVMF isn't available on this host.
OVMF_CANDIDATES=(
"/run/current-system/sw/share/OVMF/OVMF_CODE.fd"
"/run/current-system/sw/share/qemu/edk2-x86_64-code.fd"
"/nix/var/nix/profiles/system/sw/share/OVMF/OVMF_CODE.fd"
)
BIOS_ARG=()
for c in "${OVMF_CANDIDATES[@]}"; do
if [ -f "$c" ]; then
BIOS_ARG=(-bios "$c")
break
fi
done
# KVM if the host supports it; software emulation otherwise.
ACCEL_ARG=()
if [ -r /dev/kvm ]; then
ACCEL_ARG=(-enable-kvm -cpu host)
fi
echo "Launching ISO: $ISO"
exec qemu-system-x86_64 \
"${ACCEL_ARG[@]}" \
-m 4096 -smp 2 \
"${BIOS_ARG[@]}" \
-device virtio-vga-gl -display gtk,gl=on \
-device virtio-net-pci,netdev=n0 -netdev user,id=n0 \
-cdrom "$ISO" -boot d

View File

@@ -7,6 +7,10 @@ echo "Note: To test the INSTALLER, run 'nomarchy-test-installer' instead."
nix build .#nixosConfigurations.default.config.system.build.vm
if [ $? -eq 0 ]; then
# Drop any persisted VM disk so activation runs against fresh state.
# Without this, broken symlinks from a prior activation survive rebuilds
# and mask fixes on the next launch.
rm -f ./nomarchy.qcow2
echo "Success! Launching VM..."
./result/bin/run-nomarchy-vm
else