{ lib, ... }: let nomarchyLib = import ../../lib { inherit lib; }; # Same canonical schema as core/home/state.nix and the options.nix # files — keeps every state default in one place. schema = import ../../lib/state-schema.nix { inherit lib; }; systemState = nomarchyLib.readSystemState; in { # Every assignment is lib.mkDefault so a downstream /etc/nixos/system.nix # can still set e.g. `nomarchy.system.features.hybridGPU = true;` # without colliding with the state.json-derived value. Without # mkDefault, every state.json-driven option was unoverridable from # Nix — flipping hybridGPU required jq'ing the state file rather # than declaring it in your config. config.nomarchy.system = { dns = lib.mkDefault (systemState.dns or schema.system.dns); customDns = lib.mkDefault (systemState.customDns or schema.system.customDns); wifi.powersave = lib.mkDefault (systemState.wifi.powersave or schema.system.wifi.powersave); timezone = lib.mkDefault (systemState.timezone or schema.system.timezone); features = { fingerprint = lib.mkDefault (systemState.features.fingerprint or schema.system.features.fingerprint); fido2 = lib.mkDefault (systemState.features.fido2 or schema.system.features.fido2); hybridGPU = lib.mkDefault (systemState.features.hybridGPU or schema.system.features.hybridGPU); }; theme = lib.mkDefault (systemState.theme or schema.system.theme); }; }