{ config, lib, ... }: let nomarchyLib = import ../../lib { inherit lib; }; # Single source of truth for default values when state.json is missing # a key. Both core/system/options.nix and core/home/options.nix read # from this same file — changing a default in one place updates # everywhere. (Was: each consumer hardcoded its own `or X` literal, # which is how the summer-night/nord split lived for so long.) schema = import ../../lib/state-schema.nix { inherit lib; }; assetsPath = ../../themes/palettes; # Read unified state from ~/.config/nomarchy/state.json togglesState = nomarchyLib.readHomeState config.home.homeDirectory; in { # Every assignment uses lib.mkDefault so a downstream /etc/nixos/home.nix # can override the state.json-derived value. Without mkDefault, every # option here would resolve at default priority and conflict on # assignment from the user's config. config = { nomarchy = { toggles = { suspend = lib.mkDefault (togglesState.suspend or schema.home.suspend); screensaver = lib.mkDefault (togglesState.screensaver or schema.home.screensaver); idle = lib.mkDefault (togglesState.idle or schema.home.idle); nightlight = lib.mkDefault (togglesState.nightlight or schema.home.nightlight); waybar = lib.mkDefault (togglesState.waybar or schema.home.waybar); skipVsCodeTheme = lib.mkDefault (togglesState.skipVsCodeTheme or schema.home.skipVsCodeTheme); }; nightlightTemperature = lib.mkDefault (togglesState.nightlightTemperature or schema.home.nightlightTemperature); theme = lib.mkDefault (togglesState.theme or schema.home.theme); wallpaper = lib.mkDefault (togglesState.wallpaper or schema.home.wallpaper); panelPosition = lib.mkDefault (togglesState.panelPosition or schema.home.panelPosition); hyprland = { gaps_in = lib.mkDefault (togglesState.hyprland.gaps_in or schema.home.hyprland.gaps_in); gaps_out = lib.mkDefault (togglesState.hyprland.gaps_out or schema.home.hyprland.gaps_out); border_size = lib.mkDefault (togglesState.hyprland.border_size or schema.home.hyprland.border_size); }; fonts.monospace = lib.mkDefault (togglesState.font or schema.home.font); # Derived properties from the theme directory isLightMode = lib.mkDefault (nomarchyLib.isThemeLightMode { themeName = togglesState.theme or schema.home.theme; inherit assetsPath; }); iconsTheme = lib.mkDefault (nomarchyLib.getIconsTheme { themeName = togglesState.theme or schema.home.theme; inherit assetsPath; }); }; }; }