diff --git a/bin/utils/nomarchy-docs-scripts b/bin/utils/nomarchy-docs-scripts index dc12b21..daef509 100755 --- a/bin/utils/nomarchy-docs-scripts +++ b/bin/utils/nomarchy-docs-scripts @@ -109,7 +109,7 @@ all_refs=$(grep -rhE 'nomarchy-[a-z0-9]([a-z0-9-]*[a-z0-9])?' \ | grep -oE 'nomarchy-[a-z0-9]([a-z0-9-]*[a-z0-9])?' \ | grep -vE '^(nomarchy-launch|nomarchy-brightness|nomarchy-cmd|nomarchy-pkg|nomarchy-restart|nomarchy-toggle|nomarchy-theme|nomarchy-webapp-handler|nomarchy-font-selector|nomarchy-theme-selector|nomarchy-wallpaper-selector|nomarchy-setup|nomarchy-refresh|nomarchy-scripts|nomarchy-system-scripts|nomarchy-theme-engine-scripts)$' \ | grep -vE '^(nomarchy-plymouth|nomarchy-sddm-theme|nomarchy-live|nomarchy-rev|nomarchy-windows)$' \ - | grep -vE '^(nomarchy-eval-matrix)$' \ + | grep -vE '^(nomarchy-eval-matrix|nomarchy-docs-scripts|nomarchy-docs-keybindings)$' \ | sort -u) # The second denylist covers identifiers whose ambiguity survives the line # filter: `nomarchy-plymouth` / `nomarchy-sddm-theme` are Nix derivation @@ -117,9 +117,10 @@ all_refs=$(grep -rhE 'nomarchy-[a-z0-9]([a-z0-9-]*[a-z0-9])?' \ # ISO label that shows up in comments, `nomarchy-rev` is `/etc/nomarchy-rev` # (written by the ISO), and `nomarchy-windows` is a docker container name # in compose heredocs. -# The third denylist: `nomarchy-eval-matrix` is a bin/utils repo tool (like -# this generator) that names itself in its own header comment — not a -# user-facing script that ships in nomarchy-system-scripts. +# The third denylist: `nomarchy-eval-matrix`, `nomarchy-docs-scripts` (this +# generator), and `nomarchy-docs-keybindings` are bin/utils repo tools that +# name themselves in their own headers / AGENT.md — not user-facing scripts +# that ship in nomarchy-system-scripts. # --- Render: header -------------------------------------------------------- diff --git a/core/home/config/nomarchy-skill/SKILL.md b/core/home/config/nomarchy-skill/SKILL.md index c55d0cd..fa5dab1 100644 --- a/core/home/config/nomarchy-skill/SKILL.md +++ b/core/home/config/nomarchy-skill/SKILL.md @@ -57,7 +57,7 @@ This directory contains Nomarchy's source files managed by git. Any changes will **Reading `~/.local/share/nomarchy/` is SAFE and useful** - do it freely to: - Understand how nomarchy commands work: `cat $(which nomarchy-theme-set)` -- See default configs before customizing: `cat ~/.local/share/nomarchy/config/waybar/config.jsonc` +- See default configs before customizing: `cat ~/.local/share/nomarchy/config/fastfetch/config.jsonc` - Check stock theme files to copy for customization - Reference default hyprland settings: `cat ~/.config/nomarchy/default/hypr/*` @@ -370,8 +370,9 @@ nomarchy-upload-log nomarchy-refresh- # Refresh specific config file -# config-file path is relative to ~/.config/ -# eg. nomarchy-refresh-config hypr/hyprlock.conf will refresh ~/.config/hypr/hyprlock.conf +# config-file path is relative to ~/.config/; the stock copy must exist under +# ~/.local/share/nomarchy/config/ (i.e. a core/home/config item). +# eg. nomarchy-refresh-config fastfetch/config.jsonc refreshes ~/.config/fastfetch/config.jsonc nomarchy-refresh-config # Full reinstall of configs (nuclear option) diff --git a/core/home/configs.nix b/core/home/configs.nix index 76238ad..ef82d22 100644 --- a/core/home/configs.nix +++ b/core/home/configs.nix @@ -95,4 +95,12 @@ in home.file.".XCompose" = lib.mkDefault { source = ./config/nomarchy/default/xcompose; }; + + # Pristine copy of the stock configs, kept out of ~/.config so a user edit + # never touches it. `nomarchy-refresh-config` restores a file in ~/.config + # from here, and SKILL.md points users at it to diff against defaults. + xdg.dataFile."nomarchy/config".source = builtins.path { + name = "nomarchy-config"; + path = ./config; + }; } diff --git a/core/home/state.nix b/core/home/state.nix index a5149b0..7e9096a 100644 --- a/core/home/state.nix +++ b/core/home/state.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let nomarchyLib = import ../../lib { inherit lib; }; @@ -12,6 +12,19 @@ let # Read unified state from ~/.config/nomarchy/state.json togglesState = nomarchyLib.readHomeState config.home.homeDirectory; + + cfg = config.nomarchy; + # The resolved values, in state.json's on-disk shape. Seeded into the file + # so runtime consumers (nomarchy-installed-summary, the setters) see the + # real defaults instead of a missing key — without this the summary shows + # "—" for theme/font/panel on any system the installer didn't write to. + seedJSON = builtins.toJSON { + inherit (cfg) theme wallpaper panelPosition nightlightTemperature; + font = cfg.fonts.monospace; + inherit (cfg.toggles) suspend screensaver idle nightlight waybar; + inherit (cfg.hyprland) gaps_in gaps_out border_size; + }; + stateFile = "${config.home.homeDirectory}/.config/nomarchy/state.json"; in { # Every assignment uses lib.mkDefault so a downstream /etc/nixos/home.nix @@ -48,5 +61,23 @@ in inherit assetsPath; }); }; + + # Backfill any state.json key the user hasn't set. Existing values always + # win (`defaults * existing`), so a user's theme/font/etc. and any + # runtime-only keys (welcome_done, …) are never clobbered — this only + # fills the gaps so the file reflects the system's actual defaults. + home.activation.seedNomarchyState = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run mkdir -p "$(dirname ${lib.escapeShellArg stateFile})" + tmp="$(${pkgs.coreutils}/bin/mktemp)" + # Build the next file contents in $tmp first; only the final move is + # guarded by `run` so a dry-run never mutates the real state file. + if [ -e ${lib.escapeShellArg stateFile} ]; then + ${pkgs.jq}/bin/jq -n --argjson d ${lib.escapeShellArg seedJSON} \ + --slurpfile s ${lib.escapeShellArg stateFile} '$d * $s[0]' > "$tmp" + else + printf '%s\n' ${lib.escapeShellArg seedJSON} > "$tmp" + fi + run mv "$tmp" ${lib.escapeShellArg stateFile} + ''; }; } diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 954003b..9303c04 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -178,13 +178,14 @@ Pillar is **done** when every component has had a live VM pass and the roadmap c (Move items here when they land — keep them brief, link the commit/PR.) +- _2026-05-31_ — **Pillar 9 / Component 2 follow-up: grounded + fixed the three candidate bugs from the script sweep.** All three confirmed real. **(1)** `nomarchy-refresh-config` was dead on every system — it read `/etc/nixos/nomarchy/{core/home/config,features}` (the source tree never lands there; it's only at `/etc/nomarchy`, and only on VM-guest/live ISO) and fell back to `~/.local/share/nomarchy/config`, which nothing deployed even though `SKILL.md` documents it as the stock-config path. Deployed the pristine `core/home/config` tree to `~/.local/share/nomarchy/config` via `xdg.dataFile` and rewrote the script to read from there, so it works on any system without a source checkout (its only live caller, `nomarchy-refresh-fastfetch` → `fastfetch/config.jsonc`, now succeeds); fixed two stale `SKILL.md` examples that pointed at non-existent stock paths (`waybar/`, `hypr/`). Restoring arbitrary `features/`-owned configs (waybar, the full hypr tree) has no single stock mirror — deferred as a possible future feature, not grafted on. **(2)** `nomarchy-docs-scripts` shipped a stale, divergent copy in `features/scripts/utils/` (in the user `nomarchy-system-scripts` package) alongside the canonical `bin/utils/` dev tool — outside the repo it errored (`set -u` + `repo_root=…/../..`). Deleted the duplicate; grounding it surfaced **the identical bug** in `nomarchy-docs-keybindings` (a stale `features/` copy still referencing `tiling.conf` vs the canonical `tiling-v2.conf`), deleted too. Added both to the generator's self-reference denylist so they don't show as false `missing`, and regenerated `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 even though the live system used the schema defaults. Added an idempotent home-manager activation seed in `core/home/state.nix` that backfills the resolved values (`defaults * existing`, so 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. Activation file-write on a real boot is the one piece left for a live VM pass. - _2026-05-31_ — **Pillar 9: chasing a D-Bus error uncovered the whole app list being dropped.** A `DBus.Error … name is not activatable` seen during the menu run traced back to `notify-send` failing because mako wasn't running. Reproduced exactly via `uwsm-app -- mako` → "Command not found: mako". Root cause was far bigger than the notification daemon: `home.packages` in `features/default.nix` was wrapped in `lib.mkDefault`. `home.packages` is a list, and `filterOverrides` keeps only the highest-priority definitions — so the moment any other module set `home.packages` at normal priority (`features/scripts/default.nix`'s `[ nomarchy-scripts ]`, the installer's profile packages), the **entire curated mkDefault list was silently discarded**. Every install was missing firefox, thunar, imv, mpv, swww, **mako** (→ broken notifications), **hyprlock** (→ broken lock screen, the "hyprlock not found" flagged in the earlier script sweep), and rofi — and the drop also hid a stale `rofi-wayland` reference (merged into `rofi` upstream) that only errored once the list went live. Removed the `mkDefault` so the list merges (`home.packages` 31 → 52 pkgs) and fixed `rofi-wayland` → `rofi` (`1117dcf`). Verified on a rebuilt VM: mako installs + runs + owns `org.freedesktop.Notifications`, hyprlock/firefox present, and `nomarchy-toggle-waybar` (the command that errored) runs clean with no D-Bus error. Lesson for `docs/AGENT.md`-style guardrails: never wrap a *list/attrset* option in `lib.mkDefault` expecting downstream override — it makes the whole definition vanish when anything else contributes; `mkDefault` only makes sense on scalar leaves. - _2026-05-31_ — **Pillar 9 / Component 5: walker menus verified, two real bugs fixed.** Drove every walker menu in a VM (theme picker, background selector, app launcher). Found two bugs, both invisible to eval/CI: **(1)** the elephant lua menu providers (`nomarchy_themes.lua` → `menus:nomarchythemes`, `nomarchy_background_selector.lua` → `menus:nomarchyBackgroundSelector`) were deployed via the bulk nomarchy config to `~/.config/nomarchy/default/elephant/` — outside elephant's provider search path — so elephant never registered them and the theme picker / background selector returned "No Results" (used by `nomarchy-theme`, `nomarchy-wallpaper`, and the `nomarchy-menu` Style submenu). Moved them into `features/apps/elephant/config/menus/` → `~/.config/elephant/menus/` (`c831b01`); verified on a fresh boot via `elephant listproviders` and the rendered theme picker showing all 21 palettes **with per-theme preview images**. **(2)** Even once registered, the background selector still returned "No Results" because its `GetEntries` ran `find -type f`, but home-manager deploys the per-theme backgrounds as nix-store symlinks and `-type f` doesn't follow symlinks — added `-L` to match `nomarchy_themes.lua` (`c5fe0e0`); proven in the VM (`find -type f` → 0, `find -L` → the backgrounds). App launcher (desktopapplications provider) confirmed working — lists apps with icons. Note on method: walker renders reliably when launched from a terminal in-session; the `sendkey` keybinding/`esc` path is flaky headless. - _2026-05-31_ — **Pillar 9 / Component 8 + 1: full installer end-to-end on a real VM install.** Built the installer ISO, booted it in a UEFI QEMU VM with a blank 30 GB target disk, and drove `install.sh` to a complete install — then rebooted from the installed disk and verified the running system. Method: a hand-crafted `--resume` state file (env-preseed doesn't stick because `install.sh` re-inits its vars, but `load_state` sources whatever the state file contains, including the `USER_PASSWORD_HASH`/`LUKS_PASSWORD` that `save_state` omits), reducing 34 `gum` prompts to a single `expect`-driven review confirmation (a test ISO variant added SSH + `expect`; `TERM` must be overridden off `xterm-kitty`). The installer ran clean: env checks, disko (LUKS2 + BTRFS), `nixos-install` of the full desktop (~16 min, pinned to the install commit so it built this session's fixes), and its own preflight `nixos-rebuild dry-build` passed ("Configuration evaluates cleanly"). The installed system then **booted end-to-end**: UEFI → systemd-boot → themed Plymouth LUKS passphrase prompt (per-palette splash, confirming the Plymouth templating shipped earlier) → autologin → Hyprland desktop with the correct identity (`test@nomarchy-test`), form factor (desktop), timezone (UTC), CLI-Utils profile, and `FDE (LUKS): Yes`. Interactivity verified via `sendkey`: SUPER+Return opened a themed terminal, and the welcome wizard advanced into the walker theme picker (all 21 palettes listed). **No Hyprland config-error overlay** — the geforce/pip/idleinhibit + compgen fixes from this session are confirmed correct on a real install. Validates the installer, generated config, FDE boot, Plymouth theming, desktop, walker, keybindings, and first-boot UX in one pass. -- _2026-05-31_ — **Pillar 9 / Component 2 + 4: VM script sweep + theme visual pass (partial).** Built an SSH-into-VM harness (key auth + `QEMU_NET_OPTS` port-forward) and ran a 107-command sweep of the ~160 `nomarchy-*` commands. Most apparent failures were harness artifacts (non-login PATH, no `HYPRLAND_INSTANCE_SIGNATURE`, no session bus, no TTY for `gum`) — the `jq … column 28` family is just `hyprctl -j | jq` with no reachable instance over SSH. One confirmed real bug fixed: `nomarchy-haptic-touchpad` (python3 script wired as the XPS `systemd.services.nomarchy-haptic-touchpad`) died with `env: python3: not found` because `python3` wasn't in `systemScriptDeps` (`23d432f`). Theme pass (Component 4): the live `nomarchy-theme-set` rebuild path can't run in a throwaway VM (read-only store flake + Nix git-ownership check — a VM artifact), so verified rendering by booting the VM with each palette baked in as the default (`extendModules` + Stylix). Confirmed correct rendering — themed waybar, readable contrast, correct accents, no broken colours — across the **entire light-mode risk class** (catppuccin-latte, flexoki-light, rose-pine, summer-day, white) plus extremes (vantablack pure-black, summer-night default). **Still to do:** re-run the graphical scripts with the session env imported; the 14 remaining dark palettes (lower contrast risk); and the candidate bugs logged below. Candidate bugs to ground next: `nomarchy-refresh-config` reads `/etc/nixos/nomarchy/features` (doesn't exist — flake is at `/etc/nomarchy`); a repo dev-tool (`nomarchy-docs-scripts`) appears to ship in the user scripts package and hits `script_loc: unbound` outside the repo; home `~/.config/nomarchy/state.json` isn't seeded in a non-installer system so the installed-summary shows `—`. +- _2026-05-31_ — **Pillar 9 / Component 2 + 4: VM script sweep + theme visual pass (partial).** Built an SSH-into-VM harness (key auth + `QEMU_NET_OPTS` port-forward) and ran a 107-command sweep of the ~160 `nomarchy-*` commands. Most apparent failures were harness artifacts (non-login PATH, no `HYPRLAND_INSTANCE_SIGNATURE`, no session bus, no TTY for `gum`) — the `jq … column 28` family is just `hyprctl -j | jq` with no reachable instance over SSH. One confirmed real bug fixed: `nomarchy-haptic-touchpad` (python3 script wired as the XPS `systemd.services.nomarchy-haptic-touchpad`) died with `env: python3: not found` because `python3` wasn't in `systemScriptDeps` (`23d432f`). Theme pass (Component 4): the live `nomarchy-theme-set` rebuild path can't run in a throwaway VM (read-only store flake + Nix git-ownership check — a VM artifact), so verified rendering by booting the VM with each palette baked in as the default (`extendModules` + Stylix). Confirmed correct rendering — themed waybar, readable contrast, correct accents, no broken colours — across the **entire light-mode risk class** (catppuccin-latte, flexoki-light, rose-pine, summer-day, white) plus extremes (vantablack pure-black, summer-night default). **Still to do:** re-run the graphical scripts with the session env imported; the 14 remaining dark palettes (lower contrast risk); and the candidate bugs logged below. Candidate bugs to ground next: `nomarchy-refresh-config` reads `/etc/nixos/nomarchy/features` (doesn't exist — flake is at `/etc/nomarchy`); a repo dev-tool (`nomarchy-docs-scripts`) appears to ship in the user scripts package and hits `script_loc: unbound` outside the repo; home `~/.config/nomarchy/state.json` isn't seeded in a non-installer system so the installed-summary shows `—`. _(All three grounded + fixed 2026-05-31 — see the Component 2 follow-up entry above.)_ - _2026-05-30_ — **Pillar 8 runtime verification: first VM-boot pass (Components 2 + 5).** Built `nixosConfigurations.default.config.system.build.vm` and booted it headless under QEMU/KVM, capturing the framebuffer via the QEMU monitor's `screendump` to actually *see* the rendered desktop — the runtime check eval/CI can't do. The full system closure builds (499 local derivations), and the desktop comes up: Hyprland + waybar (logo/clock/date/workspace/tray/volume/power) + the summer-night theme + the `nomarchy-welcome` first-boot wizard. Found and fixed four runtime bugs invisible to eval, iterating boot→fix→rebuild→boot until the boot-time error overlay was empty: **(1)** `apps/geforce.conf` + `apps/moonlight.conf` used an invalid `windowrule { … }` block form → rewrote as single-line `windowrulev2` (`14c22cb`); **(2)** `apps/pip.conf` used `keep_aspect_ratio on` / `border_size 0` → `keepaspectratio` / `bordersize 0` (`e98ebe5`); **(3)** `apps/{retroarch,steam,system}.conf` wrote `idleinhibit, ` (comma) so the mode parsed as a selector → space-separated `idleinhibit ` (`e98ebe5`) — all three rule-syntax classes were Omarchy holdovers exposed once Component 5 wired `apps.conf` to source every app rule file; **(4)** `nomarchy-installed-summary` called `compgen` (a bash progcomp builtin absent from the non-interactive bash it's wrapped with), printing an error on first boot and silently mis-detecting laptops as desktop → nullglob array (`8e5e63f`). The summary's `—` values for theme/font/etc. in a non-installer `default` VM are expected (no populated `state.json`; `jq_or_empty` degrades gracefully). Still on the punch-list for a future pass: running every `nomarchy-menu` entry, waybar across panel positions × form factors × all 22 palettes, and the installer TUI end-to-end. diff --git a/docs/SCRIPTS.md b/docs/SCRIPTS.md index da7801e..b202e1d 100644 --- a/docs/SCRIPTS.md +++ b/docs/SCRIPTS.md @@ -24,7 +24,7 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`, - `delete-dead` — Phase B verdict: remove and update callers. - `stub-with-notify` — Phase B verdict: temporary `notify-send` stub. -## Scripts (160) +## Scripts (158) | Script | Location | Callers | Status | Notes | | --- | --- | --- | --- | --- | @@ -47,8 +47,6 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`, | `nomarchy-cmd-share` | `features/scripts/utils` | features/scripts/utils/nomarchy-menu | `kept` | | | `nomarchy-cmd-terminal-cwd` | `features/scripts/utils` | features/desktop/hyprland/config/bindings.conf | `kept` | | | `nomarchy-debug` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | -| `nomarchy-docs-keybindings` | `features/scripts/utils` | bin/utils/nomarchy-docs-keybindings | `kept` | | -| `nomarchy-docs-scripts` | `features/scripts/utils` | bin/utils/nomarchy-docs-scripts | `kept` | | | `nomarchy-drive-info` | `features/scripts/utils` | features/scripts/utils/nomarchy-drive-select | `kept` | | | `nomarchy-drive-select` | `features/scripts/utils` | features/scripts/utils/nomarchy-drive-info,features/scripts/utils/nomarchy-drive-set-password | `kept` | | | `nomarchy-drive-set-password` | `features/scripts/utils` | features/scripts/utils/nomarchy-drive-select,features/scripts/utils/nomarchy-menu | `kept` | | @@ -57,7 +55,7 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`, | `nomarchy-font-current` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md,features/scripts/utils/nomarchy-menu | `kept` | | | `nomarchy-font-list` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md,features/scripts/utils/nomarchy-font, +2 more | `kept` | | | `nomarchy-font-set` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md,features/scripts/utils/nomarchy-font, +4 more | `kept` | | -| `nomarchy-haptic-touchpad` | `core/system/scripts` | core/system/hardware.nix | `kept` | | +| `nomarchy-haptic-touchpad` | `core/system/scripts` | core/system/hardware.nix,core/system/scripts-derivation.nix | `kept` | | | `nomarchy-hibernation-available` | `core/system/scripts` | features/scripts/utils/nomarchy-menu | `kept` | | | `nomarchy-hibernation-remove` | `core/system/scripts` | features/scripts/utils/nomarchy-menu | `kept` | | | `nomarchy-hibernation-setup` | `core/system/scripts` | features/scripts/utils/nomarchy-menu | `kept` | | @@ -74,7 +72,7 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`, | `nomarchy-hyprland-workspace-layout-toggle` | `features/scripts/utils` | core/home/config/nomarchy/default/hypr/bindings/tiling-v2.conf,features/scripts/utils/nomarchy-menu | `kept` | | | `nomarchy-install` | `features/scripts/utils` | README.md,core/home/config/nomarchy-skill/SKILL.md, +2 more | `kept` | | | `nomarchy-install-docker-dbs` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | -| `nomarchy-installed-summary` | `features/scripts/utils` | features/scripts/utils/nomarchy-welcome | `kept` | | +| `nomarchy-installed-summary` | `features/scripts/utils` | core/home/state.nix,features/scripts/utils/nomarchy-welcome | `kept` | | | `nomarchy-launch-about` | `features/scripts/utils` | features/scripts/utils/nomarchy-menu | `kept` | | | `nomarchy-launch-audio` | `features/scripts/utils` | core/home/config/nomarchy/default/hypr/bindings/utilities.conf,features/desktop/waybar/config/config.jsonc, +2 more | `kept` | | | `nomarchy-launch-bluetooth` | `features/scripts/utils` | core/home/config/nomarchy/default/hypr/bindings/utilities.conf,features/desktop/waybar/config/config.jsonc, +1 more | `kept` | | @@ -91,7 +89,7 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`, | `nomarchy-launch-wifi` | `features/scripts/utils` | core/home/config/nomarchy/default/hypr/bindings/utilities.conf,core/home/config/nomarchy/default/mako/core.ini, +4 more | `kept` | | | `nomarchy-lock-screen` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md,core/home/config/nomarchy/default/hypr/bindings/utilities.conf, +3 more | `kept` | | | `nomarchy-manual` | `features/scripts/utils` | core/branding/about.txt,features/scripts/utils/nomarchy-menu, +1 more | `kept` | | -| `nomarchy-menu` | `features/scripts/utils` | README.md,bin/utils/nomarchy-docs-scripts, +9 more | `kept` | | +| `nomarchy-menu` | `features/scripts/utils` | README.md,bin/utils/nomarchy-docs-scripts, +8 more | `kept` | | | `nomarchy-menu-keybindings` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md,core/home/config/nomarchy/default/hypr/bindings/utilities.conf, +2 more | `kept` | | | `nomarchy-notification-dismiss` | `features/scripts/utils` | core/home/config/nomarchy/default/mako/core.ini | `kept` | | | `nomarchy-on-boot` | `features/scripts/utils` | core/home/config/nomarchy/default/hypr/autostart.conf | `kept` | | @@ -102,7 +100,7 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`, | `nomarchy-pkg-remove` | `features/scripts/utils` | features/scripts/utils/nomarchy-pkg-drop | `kept` | | | `nomarchy-powerprofiles-list` | `core/system/scripts` | features/scripts/utils/nomarchy-menu | `kept` | | | `nomarchy-preflight-migration` | `features/scripts/utils` | features/scripts/utils/nomarchy-env-update | `kept` | | -| `nomarchy-refresh-config` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md,features/scripts/utils/nomarchy-refresh-fastfetch | `kept` | | +| `nomarchy-refresh-config` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md,core/home/configs.nix, +1 more | `kept` | | | `nomarchy-refresh-fastfetch` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | | `nomarchy-refresh-hyprland` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | | `nomarchy-refresh-waybar` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | @@ -144,14 +142,14 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`, | `nomarchy-theme` | `features/scripts/utils` | README.md,bin/utils/nomarchy-docs-scripts, +17 more | `kept` | | | `nomarchy-theme-bg-install` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | | `nomarchy-theme-bg-next` | `themes/engine/scripts` | README.md,core/home/config/nomarchy-skill/SKILL.md, +1 more | `kept` | | -| `nomarchy-theme-bg-set` | `themes/engine/scripts` | core/home/config/nomarchy/default/elephant/nomarchy_background_selector.lua,features/scripts/utils/nomarchy-wallpaper | `kept` | | +| `nomarchy-theme-bg-set` | `themes/engine/scripts` | features/apps/elephant/config/menus/nomarchy_background_selector.lua,features/scripts/utils/nomarchy-wallpaper | `kept` | | | `nomarchy-theme-current` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md,themes/engine/scripts/nomarchy-theme-next | `kept` | | | `nomarchy-theme-install` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | | `nomarchy-theme-list` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md,features/scripts/utils/nomarchy-theme, +2 more | `kept` | | | `nomarchy-theme-next` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | | `nomarchy-theme-refresh` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | | `nomarchy-theme-remove` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md | `kept` | | -| `nomarchy-theme-set` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md,core/home/config/nomarchy/default/elephant/nomarchy_themes.lua, +9 more | `kept` | | +| `nomarchy-theme-set` | `themes/engine/scripts` | core/home/config/nomarchy-skill/SKILL.md,features/apps/elephant/config/menus/nomarchy_themes.lua, +9 more | `kept` | | | `nomarchy-theme-set-keyboard` | `themes/engine/scripts` | features/scripts/utils/nomarchy-on-boot | `kept` | | | `nomarchy-theme-set-keyboard-asus-rog` | `themes/engine/scripts` | features/scripts/utils/nomarchy-on-boot,themes/engine/scripts/nomarchy-theme-set-keyboard | `kept` | | | `nomarchy-theme-set-keyboard-f16` | `themes/engine/scripts` | features/scripts/utils/nomarchy-on-boot,themes/engine/scripts/nomarchy-theme-set-keyboard | `kept` | | diff --git a/features/scripts/utils/nomarchy-docs-keybindings b/features/scripts/utils/nomarchy-docs-keybindings deleted file mode 100755 index f1d8f14..0000000 --- a/features/scripts/utils/nomarchy-docs-keybindings +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# nomarchy-docs-keybindings -# -# Regenerates docs/KEYBINDINGS.md from the Hyprland binding files. Run from the -# repo root or anywhere — paths are resolved relative to this script. -# -# nomarchy-docs-keybindings # write to stdout -# nomarchy-docs-keybindings --out docs/KEYBINDINGS.md -# -# Source files in render order. Each entry is "|". - -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" - -sources=( - "core/home/config/nomarchy/default/hypr/bindings/utilities.conf|Utilities" - "core/home/config/nomarchy/default/hypr/bindings/tiling.conf|Tiling" - "core/home/config/nomarchy/default/hypr/bindings/tiling-v2.conf|Tiling (v2)" - "core/home/config/nomarchy/default/hypr/bindings/clipboard.conf|Clipboard" - "core/home/config/nomarchy/default/hypr/bindings/media.conf|Media keys" - "features/desktop/hyprland/config/bindings.conf|Apps & web shortcuts" -) - -prettify_key() { - case "$1" in - code:10) echo "1" ;; code:11) echo "2" ;; code:12) echo "3" ;; - code:13) echo "4" ;; code:14) echo "5" ;; code:15) echo "6" ;; - code:16) echo "7" ;; code:17) echo "8" ;; code:18) echo "9" ;; - code:19) echo "0" ;; - XF86AudioRaiseVolume) echo "Volume Up" ;; - XF86AudioLowerVolume) echo "Volume Down" ;; - XF86AudioMute) echo "Mute" ;; - XF86AudioMicMute) echo "Mic Mute" ;; - XF86AudioPlay) echo "Play/Pause" ;; - XF86AudioStop) echo "Stop" ;; - XF86AudioNext) echo "Next Track" ;; - XF86AudioPrev) echo "Previous Track" ;; - XF86MonBrightnessUp) echo "Brightness Up" ;; - XF86MonBrightnessDown) echo "Brightness Down" ;; - XF86KbdBrightnessUp) echo "Kbd Brightness Up" ;; - XF86KbdBrightnessDown) echo "Kbd Brightness Down" ;; - XF86KbdLightOnOff) echo "Kbd Backlight" ;; - *) echo "$1" ;; - esac -} - -trim() { sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//'; } - -render_section() { - local file="$1" title="$2" - [[ ! -f "$repo_root/$file" ]] && return - local rows - rows=$(grep -E '^[[:space:]]*bind[a-z]*[[:space:]]*=' "$repo_root/$file" || true) - [[ -z "$rows" ]] && return - - local body="" - while IFS= read -r line; do - # Strip the "bindXXX =" prefix. - local rhs="${line#*=}" - local mods key desc - IFS=',' read -r mods key desc _ <<<"$rhs" - mods=$(printf '%s' "${mods:-}" | trim) - key=$(printf '%s' "${key:-}" | trim) - desc=$(printf '%s' "${desc:-}" | trim) - [[ -z "$desc" ]] && continue # skip non-descriptive bindings - [[ -z "$mods" ]] && mods="—" - key=$(prettify_key "$key") - body+=$(printf '| %s | %s | %s |\n' "$mods" "$key" "$desc") - body+=$'\n' - done <<<"$rows" - - [[ -z "$body" ]] && return - - printf '\n## %s\n\n' "$title" - printf '_Source: `%s`_\n\n' "$file" - printf '| Modifiers | Key | Action |\n' - printf '| --- | --- | --- |\n' - printf '%s' "$body" -} - -main() { - cat <<'HEADER' -# Nomarchy Keybindings - -Auto-generated from the Hyprland binding files. **Do not edit by hand.** -Re-run the generator after changing any `bindings/*.conf`: - -```bash -./bin/utils/nomarchy-docs-keybindings --out docs/KEYBINDINGS.md -``` - -`SUPER` is the Meta / Win key. `code:NN` keys (X11 digit keycodes) are -shown as the digit they correspond to. Media keys (`XF86Audio*`, -`XF86MonBrightness*`, …) are prettified. -HEADER - for entry in "${sources[@]}"; do - render_section "${entry%|*}" "${entry#*|}" - done -} - -out="" -if [[ "${1:-}" == "--out" ]]; then - out="${2:?--out needs a path}"; shift 2 -fi -if [[ -n "$out" ]]; then - main >"$out" -else - main -fi diff --git a/features/scripts/utils/nomarchy-docs-scripts b/features/scripts/utils/nomarchy-docs-scripts deleted file mode 100755 index d9ab219..0000000 --- a/features/scripts/utils/nomarchy-docs-scripts +++ /dev/null @@ -1,275 +0,0 @@ -#!/usr/bin/env bash -set -e -# Generator tolerates "no matches" exit codes from grep | sort. -# pipefail and -e off; -u stays. -set -u - -# nomarchy-docs-scripts -# -# Regenerates docs/SCRIPTS.md from the repo state. Produces: -# 1. Header + status legend + regen instructions. -# 2. Table of every nomarchy-* script (location, callers, status). -# 3. Table of every menu entry in features/scripts/utils/nomarchy-menu -# (submenu, label, target command, status). -# 4. Snapshot list of orphaned references (called somewhere, no script). -# -# Status heuristic in Phase A: -# kept — file exists AND is called from at least one *.nix / *.conf / -# shell file outside its own directory. -# unused? — file exists but no caller found. Phase B decides delete-dead -# vs intentional public API. -# missing — referenced but no file. Phase B decides port-from-omarchy -# vs delete-dead vs stub-with-notify. -# -# nomarchy-docs-scripts # write to stdout -# nomarchy-docs-scripts --out docs/SCRIPTS.md - -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" -cd "$repo_root" - -# --- Inventory ------------------------------------------------------------- - -# Where scripts live, in render order. -declare -A loc_label=( - ["features/scripts/utils"]="features/scripts/utils" - ["core/system/scripts"]="core/system/scripts" - ["themes/engine/scripts"]="themes/engine/scripts" -) -script_dirs=(features/scripts/utils core/system/scripts themes/engine/scripts) - -# Build name → location map (associative array of basename → repo-relative dir). -declare -A script_loc -for dir in "${script_dirs[@]}"; do - [[ -d "$dir" ]] || continue - while IFS= read -r f; do - script_loc["$(basename "$f")"]="$dir" - done < <(find "$dir" -maxdepth 1 -type f -name 'nomarchy-*') -done - -# Find every nomarchy-* token referenced anywhere outside the script dirs. -# (We exclude the script files themselves so they don't list themselves as -# their own caller.) -# File types we search for references. *.md catches docs and README; -# branding/hook/extension files have varied or no extensions. -# *.lua catches elephant providers; *.ini catches mako on-button-* hooks; -# *.desktop catches MimeType-registered URL handlers. -grep_includes=( - --include='*.nix' --include='*.conf' --include='*.sh' --include='*.md' - --include='nomarchy-*' --include='*.jsonc' --include='*.json' - --include='*.toml' --include='*.ini' --include='*.lua' - --include='*.desktop' --include='*.txt' --include='*.sample' -) -search_dirs=(core features themes installer hosts bin lib README.md) - -# Files whose mentions of nomarchy-* are documentation about the scripts, -# not real callers. Excluded from caller discovery so they don't promote -# every script to `kept`. -self_refs=(docs/SCRIPTS.md docs/ROADMAP.md docs/AGENT.md) - -ref_files_per_cmd() { - local cmd="$1" - local self_pattern - self_pattern=$(IFS='|'; echo "${self_refs[*]}") - grep -rlE "\\b${cmd}\\b" \ - "${grep_includes[@]}" \ - "${search_dirs[@]}" 2>/dev/null \ - | grep -vE "^(features/scripts/utils|core/system/scripts|themes/engine/scripts)/${cmd}$" \ - | grep -vE "^(${self_pattern})$" \ - | sort -u -} - -# All distinct nomarchy-* tokens we see anywhere in the repo. -# Final char must be alphanumeric — dropping trailing-dash matches like -# `nomarchy-pkg-` that come from glob references (`for c in nomarchy-pkg-*`). -# Restrict to grep_includes so binaries / tmpfiles don't pollute the set. -# The middle `grep -vE` drops lines where `nomarchy-*` is a derivation / -# tmp file / sudoers basename / systemd unit / flake output / docker -# container identifier — not a shell invocation — so they don't show up -# as fake "missing" references. -all_refs=$(grep -rhE 'nomarchy-[a-z0-9]([a-z0-9-]*[a-z0-9])?' \ - "${grep_includes[@]}" \ - "${search_dirs[@]}" 2>/dev/null \ - | grep -vE \ - -e '(pname|name)[[:space:]]*=[[:space:]]*"nomarchy-' \ - -e '/tmp/nomarchy-' \ - -e '/etc/sudoers\.d/[^"[:space:]]*nomarchy-' \ - -e 'nixosConfigurations\.nomarchy-' \ - -e 'packages\.[^.]+\.nomarchy-' \ - -e '\./result/bin/run-nomarchy-' \ - -e 'mktemp[[:space:]]+[^|]*-t[[:space:]]+nomarchy-' \ - -e '(TIMER_NAME|NOPASSWD_FILE|UNIT_NAME)=.*nomarchy-' \ - -e 'docker[[:space:]]+[^|]*nomarchy-' \ - | grep -oE 'nomarchy-[a-z0-9]([a-z0-9-]*[a-z0-9])?' \ - | grep -vE '^(nomarchy-plymouth|nomarchy-sddm-theme|nomarchy-live|nomarchy-rev|nomarchy-windows)$' \ - | sort -u) -# The token-level denylist above covers identifiers whose ambiguity survives -# the line filter: `nomarchy-plymouth` / `nomarchy-sddm-theme` are Nix -# derivation names referenced as bare idents in `[...]` lists, -# `nomarchy-live` is an ISO label that shows up in comments, `nomarchy-rev` -# is `/etc/nomarchy-rev` (a file written by the ISO), and -# `nomarchy-windows` is a docker container name in compose heredocs. - -# --- Render: header -------------------------------------------------------- - -main() { - cat <<'HEADER' -# Nomarchy Script & Menu Audit - -Auto-generated table for [Pillar 3 of the roadmap](ROADMAP.md#3-pillar-script--menu-audit). -**Do not edit by hand.** Regenerate after script or menu changes: - -```bash -./bin/utils/nomarchy-docs-scripts --out docs/SCRIPTS.md -``` - -The status column uses a Phase A heuristic — `kept` / `unused?` / `missing`. -Phase B (per-batch PRs) refines those into `port-from-omarchy`, -`delete-dead`, or `stub-with-notify` and updates the rows. - -## Status legend - -- `kept` — script exists and is called from somewhere outside its own directory. -- `unused?` — script exists but no caller was found. Could be dead, could be - intentional public API. Phase B triage decides. -- `missing` — referenced from code but no script file exists. Phase B triage - decides whether to port from Omarchy upstream, delete the caller, or stub - with `notify-send`. -- `port-from-omarchy` — Phase B verdict: lift the upstream Omarchy script, - rewrite for NixOS paths. -- `delete-dead` — Phase B verdict: remove and update callers. -- `stub-with-notify` — Phase B verdict: temporary `notify-send` stub. - -HEADER - - # --- Render: scripts table ---------------------------------------------- - printf '## Scripts (%d)\n\n' "${#script_loc[@]}" - printf '| Script | Location | Callers | Status | Notes |\n' - printf '| --- | --- | --- | --- | --- |\n' - - # Sort scripts by name. - for name in $(printf '%s\n' "${!script_loc[@]}" | sort); do - local dir="${script_loc[$name]}" - local callers status callers_str - callers=$(ref_files_per_cmd "$name") - if [[ -z "$callers" ]]; then - status='`unused?`' - callers_str='—' - else - status='`kept`' - # Trim caller list to 2 entries + count. - local count - count=$(printf '%s\n' "$callers" | wc -l) - if (( count > 2 )); then - callers_str=$(printf '%s\n' "$callers" | head -2 | paste -sd, -) - callers_str="$callers_str, +$((count - 2)) more" - else - callers_str=$(printf '%s\n' "$callers" | paste -sd, -) - fi - fi - printf '| `%s` | `%s` | %s | %s | |\n' \ - "$name" "$dir" "$callers_str" "$status" - done - echo - - # --- Render: missing references ----------------------------------------- - printf '## Missing references\n\n' - printf 'Tokens grepped from `core/`, `features/`, `themes/`, `installer/`, `hosts/`, `bin/`, `lib/` that have no matching script file.\n\n' - printf '| Token | Referenced in | Status |\n' - printf '| --- | --- | --- |\n' - while IFS= read -r token; do - [[ -z "$token" ]] && continue - [[ -n "${script_loc[$token]:-}" ]] && continue - local refs - self_pattern=$(IFS='|'; echo "${self_refs[*]}") - refs=$(grep -rlE "\\b${token}\\b" \ - "${grep_includes[@]}" \ - "${search_dirs[@]}" 2>/dev/null \ - | grep -vE "^(${self_pattern})$" \ - | sort -u) - [[ -z "$refs" ]] && continue - local count refs_str - count=$(printf '%s\n' "$refs" | wc -l) - if (( count > 2 )); then - refs_str=$(printf '%s\n' "$refs" | head -2 | paste -sd, -) - refs_str="$refs_str, +$((count - 2)) more" - else - refs_str=$(printf '%s\n' "$refs" | paste -sd, -) - fi - printf '| `%s` | %s | `missing` |\n' "$token" "$refs_str" - done <<<"$all_refs" - echo - - # --- Render: menu items ------------------------------------------------- - printf '## Menu items\n\n' - printf 'Walked from `features/scripts/utils/nomarchy-menu`. Each `case` arm in a `show_*_menu` function becomes one row.\n\n' - printf '| Submenu | Entry | Calls | Status |\n' - printf '| --- | --- | --- | --- |\n' - - awk ' - /^show_[a-z_]+_menu\(\) {/ { sub(/\(\) {/, ""); current=$1; in_func=1; next } - /^[a-z_]+\(\) {/ && !/^show_/ { current=""; in_func=0; next } - /^}$/ { current=""; in_func=0; next } - !in_func { next } - /^ case \$\(menu / { - # extract the menu title between the first pair of double quotes - match($0, /menu "[^"]+" "[^"]+"/); - if (RSTART == 0) next; - title=substr($0, RSTART, RLENGTH); - # second quoted string is the option list - n=split(title, parts, "\""); - title=parts[2]; - options=parts[4]; - # split options on \n - split(options, opts, "\\\\n"); - pending_submenu=current; - pending_title=title; - for (i=1;i<=length(opts);i++) pending_opts[i]=opts[i]; - pending_count=length(opts); - next - } - /^ \*[A-Za-z]/ { - # case arm — extract pattern between the first * and the closing ) - match($0, /\*[^)]*\)/); - if (RSTART == 0) next; - arm=substr($0, RSTART, RLENGTH); - gsub(/[*)]/, "", arm); - gsub(/^[[:space:]]+|[[:space:]]+$/, "", arm); - # action follows the ) - rest=substr($0, RSTART+RLENGTH); - sub(/^[[:space:]]+/, "", rest); - sub(/[[:space:]]*;;[[:space:]]*$/, "", rest); - # match the first nomarchy-* token in the action - cmd="" - if (match(rest, /nomarchy-[a-z0-9-]+/)) { - cmd=substr(rest, RSTART, RLENGTH); - } - printf "%s|%s|%s\n", pending_submenu, arm, cmd; - } - ' features/scripts/utils/nomarchy-menu > /tmp/nomarchy-menu-rows.$$ - - while IFS='|' read -r submenu entry cmd; do - [[ -z "$entry" ]] && continue - [[ "$entry" =~ ^\) ]] && continue - status='`kept`' - if [[ -n "$cmd" ]]; then - if [[ -z "${script_loc[$cmd]:-}" ]]; then - status='`missing`' - fi - else - cmd='_(inline)_' - fi - printf '| `%s` | %s | `%s` | %s |\n' "$submenu" "$entry" "$cmd" "$status" - done < /tmp/nomarchy-menu-rows.$$ - rm -f /tmp/nomarchy-menu-rows.$$ - echo -} - -out="" -if [[ "${1:-}" == "--out" ]]; then - out="${2:?--out needs a path}"; shift 2 -fi -if [[ -n "$out" ]]; then - main >"$out" -else - main -fi diff --git a/features/scripts/utils/nomarchy-refresh-config b/features/scripts/utils/nomarchy-refresh-config old mode 100644 new mode 100755 index af40d04..45b9b71 --- a/features/scripts/utils/nomarchy-refresh-config +++ b/features/scripts/utils/nomarchy-refresh-config @@ -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