refactor(#107): theme-state.json → state.json, theme-sync → state-sync
Some checks failed
Check / eval (push) Has been cancelled
Some checks failed
Check / eval (push) Has been cancelled
The machine flake's git-tracked settings file is system state, not "theme" only — rename it to state.json. CLI becomes nomarchy-state-sync with a nomarchy-theme-sync symlink for scripts and muscle memory. Eval (mkFlake, doctor, lifecycle) still accepts theme-state.json; the next write migrates to state.json and removes the legacy file. Documented in MIGRATION.md; drop the CLI alias after release notes.
This commit is contained in:
@@ -24,11 +24,11 @@ let
|
||||
# Control Center's Bluetooth toggle writes settings.bluetooth.enable; read
|
||||
# it from the state file, the only place it exists on the NixOS side (the
|
||||
# hardware.nix/timezone.nix bridge). Missing/invalid JSON fails closed via
|
||||
# theme-state-read.nix rather than a raw stack. null = key absent, which
|
||||
# state-read.nix rather than a raw stack. null = key absent, which
|
||||
# leaves the option's own default (true) alone.
|
||||
sysState =
|
||||
if cfg.stateFile != null
|
||||
then import ../theme-state-read.nix { inherit lib; } cfg.stateFile
|
||||
then import ../state-read.nix { inherit lib; } cfg.stateFile
|
||||
else { };
|
||||
stateBluetooth =
|
||||
let v = (sysState.settings or { }).bluetooth.enable or null;
|
||||
@@ -70,7 +70,7 @@ in
|
||||
nomarchy-pull update flake inputs (nomarchy, nixpkgs, …)
|
||||
nomarchy-rebuild rebuild the system (current lock)
|
||||
nomarchy-home rebuild the desktop / Home Manager
|
||||
nomarchy-theme-sync apply <theme> switch the whole palette
|
||||
nomarchy-state-sync apply <theme> switch the whole palette
|
||||
nomarchy-doctor read-only health check
|
||||
SUPER+? keybindings cheatsheet
|
||||
SUPER+M → System › Firmware check LVFS firmware updates (fwupd)
|
||||
@@ -336,7 +336,7 @@ in
|
||||
# ── Fonts ────────────────────────────────────────────────────────
|
||||
# The ten most popular Nerd Fonts ship by default, so any of them
|
||||
# can be named in the theme state's fonts.mono and actually resolve
|
||||
# (nomarchy-theme-sync warns when a configured font is missing).
|
||||
# (nomarchy-state-sync warns when a configured font is missing).
|
||||
fonts = {
|
||||
packages = with pkgs; [
|
||||
nerd-fonts.jetbrains-mono
|
||||
@@ -373,7 +373,7 @@ in
|
||||
|
||||
# ── Essential packages ───────────────────────────────────────────
|
||||
environment.systemPackages = with pkgs; [
|
||||
nomarchy-theme-sync # provided by overlays.default
|
||||
nomarchy-state-sync # provided by overlays.default
|
||||
nomarchy-doctor # read-only health check (System › Doctor)
|
||||
nomarchy-control-center # TUI control center
|
||||
nomarchy-detect-hw # post-install hardware re-probe (HARDWARE.md §8)
|
||||
@@ -508,7 +508,7 @@ in
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
auto-optimise-store = lib.mkDefault true;
|
||||
# The downstream flake (~/.nomarchy) is meant to be a live working
|
||||
# tree: nomarchy-theme-sync rewrites theme-state.json on every
|
||||
# tree: nomarchy-state-sync rewrites state.json on every
|
||||
# switch (and you needn't commit each tweak), so the "Git tree is
|
||||
# dirty" warning fires on every rebuild and is pure noise here.
|
||||
warn-dirty = lib.mkDefault false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Greeter — greetd/tuigreet, themed from the same theme-state.json that
|
||||
# Greeter — greetd/tuigreet, themed from the same state.json that
|
||||
# drives the desktop (nomarchy.system.stateFile; the Plymouth model:
|
||||
# baked at SYSTEM rebuild, so it follows the theme as of the last
|
||||
# sys-update, not the last instant apply).
|
||||
@@ -27,7 +27,7 @@ let
|
||||
cfg = config.nomarchy.system;
|
||||
distroName = config.system.nixos.distroName;
|
||||
|
||||
sync = lib.getExe pkgs.nomarchy-theme-sync;
|
||||
sync = lib.getExe pkgs.nomarchy-state-sync;
|
||||
|
||||
# Menu/CLI toggle, same shape as nomarchy-autotimezone: runs as the normal
|
||||
# user (it owns the flake checkout + writes the state), sudos only the
|
||||
@@ -62,12 +62,12 @@ let
|
||||
fi
|
||||
'';
|
||||
|
||||
# Fails closed with an actionable message via theme-state-read.nix, like
|
||||
# Fails closed with an actionable message via state-read.nix, like
|
||||
# every other stateFile consumer — a raw fromJSON here would bury a bad
|
||||
# state file under a Nix stack pointing at greeter.nix.
|
||||
state =
|
||||
if cfg.stateFile != null
|
||||
then import ../theme-state-read.nix { inherit lib; } cfg.stateFile
|
||||
then import ../state-read.nix { inherit lib; } cfg.stateFile
|
||||
else { };
|
||||
|
||||
# The auto-login user from the state, or null. Read here via the state file
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
|
||||
let
|
||||
cfg = config.nomarchy.hardware;
|
||||
# Fingerprint PAM can follow theme-state.json (menu toggle → next
|
||||
# Fingerprint PAM can follow state.json (menu toggle → next
|
||||
# sys-rebuild), same bridge as autoTimezone (BACKLOG #55). Missing or
|
||||
# invalid JSON fails closed (theme-state-read.nix) instead of a raw stack.
|
||||
# invalid JSON fails closed (state-read.nix) instead of a raw stack.
|
||||
hwState =
|
||||
if config.nomarchy.system.stateFile != null
|
||||
then import ../theme-state-read.nix { inherit lib; } config.nomarchy.system.stateFile
|
||||
then import ../state-read.nix { inherit lib; } config.nomarchy.system.stateFile
|
||||
else { };
|
||||
pamFromState = (hwState.settings or { }).fingerprint.pam or false;
|
||||
|
||||
sync = lib.getExe pkgs.nomarchy-theme-sync;
|
||||
sync = lib.getExe pkgs.nomarchy-state-sync;
|
||||
|
||||
# The single fingerprint on/off switch (System › Fingerprint). One state key
|
||||
# for one user-facing decision — it drives login/sudo PAM here AND the
|
||||
@@ -156,11 +156,11 @@ in
|
||||
type = lib.types.bool;
|
||||
default = pamFromState;
|
||||
defaultText = lib.literalExpression
|
||||
"(settings.fingerprint.pam from theme-state.json) or false";
|
||||
"(settings.fingerprint.pam from state.json) or false";
|
||||
description = ''
|
||||
Use the fingerprint for login and sudo (PAM). Opt-in — password-only
|
||||
stays the default for the cautious; enroll a finger first. Defaults
|
||||
from theme-state.json `settings.fingerprint.pam` (System › Fingerprint
|
||||
from state.json `settings.fingerprint.pam` (System › Fingerprint
|
||||
menu) when set; otherwise false.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
defaultText = lib.literalExpression
|
||||
"(settings.greeter.autoLogin from theme-state.json) or null";
|
||||
"(settings.greeter.autoLogin from state.json) or null";
|
||||
example = "ada";
|
||||
description = ''
|
||||
Log this user straight into Hyprland on boot (greetd
|
||||
initial_session); logging out lands on the normal greeter.
|
||||
|
||||
Normally you leave this alone and use System › Auto-login, which
|
||||
writes `settings.greeter.autoLogin` in theme-state.json —
|
||||
writes `settings.greeter.autoLogin` in state.json —
|
||||
./greeter.nix mkDefaults this option from it. The installer seeds
|
||||
that state on LUKS-encrypted machines: the disk passphrase already
|
||||
gates access, so a second prompt is ceremony. Setting this option by
|
||||
@@ -30,15 +30,15 @@
|
||||
|
||||
plymouth.enable = lib.mkEnableOption ''
|
||||
the Nomarchy Plymouth boot splash (logo + progress + LUKS prompt),
|
||||
background-tinted from theme-state.json via nomarchy.system.stateFile.
|
||||
background-tinted from state.json via nomarchy.system.stateFile.
|
||||
Recolors on system rebuilds — theme switches don't touch the initrd'' // { default = true; };
|
||||
|
||||
stateFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
example = lib.literalExpression "./theme-state.json";
|
||||
example = lib.literalExpression "./state.json";
|
||||
description = ''
|
||||
theme-state.json for the system-side consumers (currently the
|
||||
state.json for the system-side consumers (currently the
|
||||
Plymouth splash background). lib.mkFlake wires it automatically
|
||||
from your flake; null falls back to the Boreal base color.
|
||||
'';
|
||||
@@ -59,7 +59,7 @@
|
||||
bluetooth.enable = lib.mkEnableOption "Bluetooth support with blueman" // {
|
||||
default = true;
|
||||
defaultText = lib.literalExpression
|
||||
"(settings.bluetooth.enable from theme-state.json) or true";
|
||||
"(settings.bluetooth.enable from state.json) or true";
|
||||
};
|
||||
|
||||
autoTimezone.enable = lib.mkEnableOption ''
|
||||
@@ -119,7 +119,7 @@
|
||||
batteryChargeLimit = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.ints.between 50 100);
|
||||
# No state bridge at eval time, by design: ./power.nix's oneshot reads
|
||||
# settings.power.batteryChargeLimit out of the live theme-state.json
|
||||
# settings.power.batteryChargeLimit out of the live state.json
|
||||
# with jq at *runtime* and prefers it over this baked value, so the
|
||||
# menu applies before (and without) a rebuild. This used to read
|
||||
# `config.nomarchy.settings…`, which does not exist on the NixOS side
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Plymouth boot splash — Nomarchy-branded (ported from the legacy
|
||||
# iteration), background tinted from the same theme-state.json that
|
||||
# iteration), background tinted from the same state.json that
|
||||
# drives the desktop (nomarchy.system.stateFile, wired automatically by
|
||||
# lib.mkFlake). One caveat by design: theme switches are Home
|
||||
# Manager-only and never touch the initrd, so the splash follows the
|
||||
# theme as of the last SYSTEM rebuild (`sys-update`), not the last
|
||||
# `nomarchy-theme-sync apply`.
|
||||
# `nomarchy-state-sync apply`.
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
@@ -12,7 +12,7 @@ let
|
||||
|
||||
state =
|
||||
if cfg.stateFile != null
|
||||
then import ../theme-state-read.nix { inherit lib; } cfg.stateFile
|
||||
then import ../state-read.nix { inherit lib; } cfg.stateFile
|
||||
else { };
|
||||
colorOf = key: fallback: lib.removePrefix "#" ((state.colors or { }).${key} or fallback);
|
||||
# Fallbacks match the distro default theme (Boreal) when stateFile is null.
|
||||
|
||||
@@ -58,7 +58,7 @@ in
|
||||
# Instant menu path (user decision 2026-07-10): the threshold node is
|
||||
# group-writable for `users` so nomarchy-menu can echo live without
|
||||
# rebuild; this oneshot still owns boot + AC-replug re-apply. Prefer
|
||||
# live theme-state.json under /home/*/.nomarchy so a menu change
|
||||
# live state.json under /home/*/.nomarchy so a menu change
|
||||
# survives reboot before the next sys-rebuild bakes the Nix option.
|
||||
systemd.services.nomarchy-battery-charge-limit = lib.mkIf cfg.laptop {
|
||||
description = "Apply battery charge end threshold from state or config";
|
||||
@@ -80,7 +80,7 @@ in
|
||||
# Baked generation default (empty = full charge / no cap).
|
||||
limit=${if cfg.batteryChargeLimit != null then toString cfg.batteryChargeLimit else ""}
|
||||
# Prefer the newest live state write (menu path, no rebuild yet).
|
||||
for st in /home/*/.nomarchy/theme-state.json; do
|
||||
for st in /home/*/.nomarchy/state.json; do
|
||||
[ -r "$st" ] || continue
|
||||
v=$(jq -r '.settings.power.batteryChargeLimit // empty' "$st" 2>/dev/null || true)
|
||||
case "$v" in
|
||||
|
||||
@@ -11,11 +11,11 @@ let
|
||||
# Control Center's Printing toggle writes settings.printing.enable; read it
|
||||
# from the state file, the only place it exists on the NixOS side (the
|
||||
# hardware.nix/timezone.nix bridge). Missing/invalid JSON fails closed via
|
||||
# theme-state-read.nix rather than a raw stack. null = key absent, which
|
||||
# state-read.nix rather than a raw stack. null = key absent, which
|
||||
# leaves the option's own default alone.
|
||||
svcState =
|
||||
if config.nomarchy.system.stateFile != null
|
||||
then import ../theme-state-read.nix { inherit lib; } config.nomarchy.system.stateFile
|
||||
then import ../state-read.nix { inherit lib; } config.nomarchy.system.stateFile
|
||||
else { };
|
||||
statePrinting =
|
||||
let v = (svcState.settings or { }).printing.enable or null;
|
||||
@@ -97,7 +97,7 @@ in
|
||||
System ▸ Printers entry opens the system-config-printer GUI'' // {
|
||||
default = false;
|
||||
defaultText = lib.literalExpression
|
||||
"(settings.printing.enable from theme-state.json) or false";
|
||||
"(settings.printing.enable from state.json) or false";
|
||||
};
|
||||
|
||||
openrgb.enable = lib.mkEnableOption ''
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# /etc/localtime at runtime.
|
||||
#
|
||||
# In-flake state, menu-driven (the keyboard/night-light philosophy): the on/off
|
||||
# flag lives in the same theme-state.json under `settings.autoTimezone`
|
||||
# flag lives in the same state.json under `settings.autoTimezone`
|
||||
# (git-tracked, reproducible), written by the System-menu toggle
|
||||
# (nomarchy-autotimezone). Because this is a SYSTEM service — not a user unit it
|
||||
# can start/stop instantly like night-light — the toggle drives a system rebuild
|
||||
@@ -16,14 +16,14 @@ let
|
||||
|
||||
# Read the same state file the rest of the system side uses (Plymouth too),
|
||||
# wired by lib.mkFlake. The flag defaults off when stateFile is null;
|
||||
# a set-but-missing/invalid path fails closed via theme-state-read.nix.
|
||||
# a set-but-missing/invalid path fails closed via state-read.nix.
|
||||
state =
|
||||
if cfg.stateFile != null
|
||||
then import ../theme-state-read.nix { inherit lib; } cfg.stateFile
|
||||
then import ../state-read.nix { inherit lib; } cfg.stateFile
|
||||
else { };
|
||||
stateEnabled = (state.settings or { }).autoTimezone or false;
|
||||
|
||||
sync = lib.getExe pkgs.nomarchy-theme-sync;
|
||||
sync = lib.getExe pkgs.nomarchy-state-sync;
|
||||
|
||||
# Menu/CLI toggle. Runs as the normal user (it owns the flake checkout +
|
||||
# writes the state); sudos only the system switch, like sys-update. Writes
|
||||
|
||||
Reference in New Issue
Block a user