fix(install): normalize empty keyboard variants
All checks were successful
Check / eval (push) Successful in 3m18s
All checks were successful
Check / eval (push) Successful in 3m18s
Treat the picker-only (none) row as an empty XKB variant at the shared input boundary and again in the template patcher. Guard the real downstream output and console keymap, and carry the sentinel through the offline installer VM. Verified: V0 full flake evaluation plus shell/Python/Nix/diff checks; V1 installer-keyboard, installer-safety, and template-SoT builds; V2 full KVM offline LUKS+swap install and themed first boot. No V3 required.
This commit is contained in:
@@ -32,6 +32,12 @@ def nix_str(s: str) -> str:
|
||||
)
|
||||
|
||||
|
||||
def keyboard_variant(v: dict) -> str:
|
||||
"""Return the XKB value, never the picker's display-only sentinel."""
|
||||
variant = v.get("keyboardVariant") or ""
|
||||
return "" if variant == "(none)" else variant
|
||||
|
||||
|
||||
def replace_once(text: str, old: str, new: str, label: str) -> str:
|
||||
if old not in text:
|
||||
sys.exit(f"patch-template: missing placeholder for {label}: {old!r}")
|
||||
@@ -75,7 +81,7 @@ def patch_flake(text: str, v: dict) -> str:
|
||||
|
||||
def patch_home(text: str, v: dict) -> str:
|
||||
layout = nix_str(v["keyboardLayout"])
|
||||
variant = nix_str(v.get("keyboardVariant") or "")
|
||||
variant = nix_str(keyboard_variant(v))
|
||||
text = replace_once(
|
||||
text,
|
||||
' nomarchy.keyboard.layout = "us";',
|
||||
@@ -213,7 +219,7 @@ def patch_system(text: str, v: dict) -> str:
|
||||
text = replace_once(
|
||||
text,
|
||||
' services.xserver.xkb.variant = "";',
|
||||
f' services.xserver.xkb.variant = "{nix_str(v.get("keyboardVariant") or "")}";',
|
||||
f' services.xserver.xkb.variant = "{nix_str(keyboard_variant(v))}";',
|
||||
"xkb variant",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user