feat(menu): one fingerprint switch, an auto-login toggle, and the state bridge they needed
All checks were successful
Check / eval (push) Successful in 3m7s

Bernardo, post-reboot: "Use for login" was the wrong question. Whether the
finger works is one decision, not two, and whether login prompts at all is
a different decision that was never in the menu.

System › Fingerprint is now a single Fingerprint (on/off) switch, leading
the menu with enroll/list/verify/delete as the plumbing behind it. It
writes the one settings.fingerprint.pam key, and modules/home/idle.nix now
defaults idle.fingerprint from that same key — so the lock screen and
login/sudo move together instead of drifting apart the way they did until
e2de906. nomarchy-fingerprint does the two rebuilds this needs (sudo
system for PAM, home switch for hyprlock) and refuses to turn on with no
finger enrolled.

System › Auto-login is new (nomarchy-autologin), and it is what decides
whether anything is asked at boot: auto-login on means no prompt whatever
the fingerprint switch says; off means the greeter asks, for a password or
a finger. Installer-seeded ON for LUKS machines — the passphrase already
gates the disk — and off without it, where the greeter is the only thing
between power-on and the desktop.

Both had to become state-owned to be toggleable at all, which surfaced two
real bugs:

  * nomarchy.system.greeter.autoLogin defaulted from
    `config.nomarchy.settings…` — an attribute that exists ONLY on the Home
    Manager side. On NixOS it is absent and `or null` swallowed the error,
    so the default silently evaluated to null on every machine ever built.
    That is why the installer baked a Nix line: the state path never
    worked. Now read via theme-state-read.nix (the hardware.nix/timezone.nix
    pattern) and mkDefault'd, so the menu owns it and a hand-set line still
    pins it. Two more options read the same phantom bridge — BACKLOG #116.
  * `theme-sync get` printed Python's "None" for a JSON null, so every
    `case … null)` a caller writes would miss. Now prints "null", as the
    comment above it already promised for booleans.

The installer seeds the state instead of emitting the system.nix line,
because that line outranks the state and would strand the toggle.

V1 (V3 pending: HARDWARE-QUEUE). nix flake check --no-build, installer-
safety and option-docs all pass. Proved by eval/build, not assumed: a state
carrying autoLogin yields greetd initial_session {"user":"bernardo"}, the
template state (no autoLogin) yields none, and a hand-set null beats a state
that says otherwise; a state with only fingerprint.pam=true — nothing set by
hand — renders the hyprlock auth.fingerprint block; both new tools pass
bash -n and land in systemPackages (nomarchy-fingerprint only with a
reader); the patcher writes settings.greeter.autoLogin and no system.nix
line; and the get round trip prints null, so the menu reads "Auto-login
(off)" where it would have read "(on)".

The reader itself, the two rebuilds, and the reboot are hardware — queued.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 14:34:56 +01:00
parent 9792976b11
commit eb38008ebb
14 changed files with 334 additions and 60 deletions

View File

@@ -104,12 +104,10 @@ def build_installer_region(v: dict) -> str:
" # active; heavier opt-ins stay in the commented catalog below.",
]
if v.get("autoLogin"):
user = nix_str(v["username"])
lines += [
" # LUKS passphrase already gates this machine — skip the greeter password.",
f' nomarchy.system.greeter.autoLogin = "{user}";',
]
# Auto-login is deliberately NOT emitted here — it is seeded into
# theme-state.json instead (patch_state). A line in system.nix outranks
# the state default, which would make the System Auto-login toggle
# write JSON that nothing reads.
if v.get("laptop"):
lines += [
@@ -250,6 +248,23 @@ def patch_system(text: str, v: dict) -> str:
return text
def patch_state(text: str, v: dict) -> str:
"""Seed menu-owned settings into theme-state.json.
These live in the state rather than system.nix precisely so the menu can
change them later: a baked Nix assignment would outrank the state default
and strand the toggle. Auto-login is on when the disk is encrypted — the
LUKS passphrase already gates the machine, so a greeter password is a
second prompt for the same thing; without LUKS it stays off, where the
greeter is the only thing standing between power-on and the desktop.
"""
state = json.loads(text)
settings = state.setdefault("settings", {})
if v.get("autoLogin"):
settings.setdefault("greeter", {})["autoLogin"] = v["username"]
return json.dumps(state, indent=2) + "\n"
def main() -> None:
if len(sys.argv) != 2:
sys.exit("usage: patch-template.py <flake-dir>")
@@ -260,6 +275,7 @@ def main() -> None:
"flake.nix": patch_flake,
"home.nix": patch_home,
"system.nix": patch_system,
"theme-state.json": patch_state,
}
for name, fn in mapping.items():
path = flake_dir / name