fix: ground + fix three Pillar-9 candidate bugs from the script sweep
All checks were successful
Check / eval-and-lint (push) Successful in 6m40s

All three confirmed real on inspection.

1. nomarchy-refresh-config was dead on every system: it read
   /etc/nixos/nomarchy/{core/home/config,features} (the source tree never
   lands there — only /etc/nomarchy on VM-guest/live ISO) and fell back to
   ~/.local/share/nomarchy/config, which nothing deployed despite SKILL.md
   documenting it. Deploy the pristine core/home/config tree to
   ~/.local/share/nomarchy/config via xdg.dataFile and read from there, so it
   works without a source checkout; its live caller nomarchy-refresh-fastfetch
   now succeeds. Fix two stale SKILL.md examples (waybar/, hypr/) that pointed
   at non-existent stock paths.

2. nomarchy-docs-scripts shipped a stale divergent copy in
   features/scripts/utils/ (in the user nomarchy-system-scripts package)
   beside the canonical bin/utils dev tool — it errored outside the repo.
   Grounding it surfaced the identical bug in nomarchy-docs-keybindings.
   Delete both duplicates, add them to the generator's self-reference
   denylist so they don't show as false `missing`, regenerate docs/SCRIPTS.md.

3. Home ~/.config/nomarchy/state.json was never seeded on non-installer
   systems, so nomarchy-installed-summary rendered "—" for theme/font/panel.
   Add an idempotent home-manager activation seed in core/home/state.nix that
   backfills the resolved values (defaults * existing — user choices and
   runtime-only keys like welcome_done always win).

Verified: flake check + full eval matrix clean; refresh-config happy/error
paths and the seed deep-merge proven by hand.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-05-31 14:25:02 +01:00
parent 00b8214cb1
commit 0fbc3d9c82
9 changed files with 75 additions and 433 deletions

47
features/scripts/utils/nomarchy-refresh-config Normal file → Executable file
View File

@@ -1,9 +1,13 @@
#!/bin/bash
set -e
# nomarchy-refresh-config: Restore a specific configuration file to its stock version.
# Usage: nomarchy-refresh-config <relative-path-to-config>
# Example: nomarchy-refresh-config hypr/hyprland.conf
# nomarchy-refresh-config: Restore a config file in ~/.config to its stock
# version. The pristine copies live in ~/.local/share/nomarchy/config (deployed
# by core/home/configs.nix), so this works on any system without needing the
# flake source tree on disk.
#
# Usage: nomarchy-refresh-config <relative-path-under-~/.config>
# Example: nomarchy-refresh-config fastfetch/config.jsonc
CONFIG_FILE=$1
@@ -12,34 +16,17 @@ if [[ -z $CONFIG_FILE ]]; then
exit 1
fi
# Determine source directory (where stock configs are stored)
# In Nomarchy, we deploy them via Nix, but we also keep a copy in local share for easy access
STOCK_DIR="$HOME/.local/share/nomarchy/themes" # Fallback if specific config isn't themed
# Wait, actually we should use the one from /etc/nixos if available
STOCK_BASE="/etc/nixos/nomarchy/core/home/config"
if [ ! -d "$STOCK_BASE" ]; then
# Fallback to local share if /etc/nixos is not available
STOCK_BASE="$HOME/.local/share/nomarchy/config"
fi
STOCK_BASE="${XDG_DATA_HOME:-$HOME/.local/share}/nomarchy/config"
SOURCE_FILE="$STOCK_BASE/$CONFIG_FILE"
DEST_FILE="$HOME/.config/$CONFIG_FILE"
DEST_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/$CONFIG_FILE"
if [ ! -f "$SOURCE_FILE" ]; then
# Try searching in features/ as well
STOCK_BASE="/etc/nixos/nomarchy/features"
# Find the file in features
SOURCE_FILE=$(find "$STOCK_BASE" -name "$(basename "$CONFIG_FILE")" | head -n 1)
fi
if [[ -n $SOURCE_FILE ]] && [[ -f "$SOURCE_FILE" ]]; then
echo "Refreshing $DEST_FILE from stock $SOURCE_FILE..."
mkdir -p "$(dirname "$DEST_FILE")"
cp "$SOURCE_FILE" "$DEST_FILE"
notify-send "Config Refreshed" "$CONFIG_FILE has been restored to defaults."
else
echo "Error: Stock configuration for $CONFIG_FILE not found."
notify-send -u critical "Error" "Stock configuration for $CONFIG_FILE not found."
if [[ ! -f "$SOURCE_FILE" ]]; then
echo "Error: Stock configuration for $CONFIG_FILE not found in $STOCK_BASE."
notify-send -u critical "Error" "No stock config for $CONFIG_FILE." 2>/dev/null || true
exit 1
fi
echo "Refreshing $DEST_FILE from stock $SOURCE_FILE..."
mkdir -p "$(dirname "$DEST_FILE")"
cp "$SOURCE_FILE" "$DEST_FILE"
notify-send "Config Refreshed" "$CONFIG_FILE has been restored to defaults." 2>/dev/null || true