feat: migrate theme and font to declarative Nix options
Some checks failed
Check / eval-and-lint (push) Has been cancelled
Some checks failed
Check / eval-and-lint (push) Has been cancelled
This commit is contained in:
@@ -42,7 +42,11 @@ in
|
||||
theme = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = schema.home.theme;
|
||||
description = "System theme name.";
|
||||
description = ''
|
||||
System theme name. This is the declarative source of truth.
|
||||
Changing this and running `nomarchy-env-update` (or a system
|
||||
rebuild) will update the entire desktop.
|
||||
'';
|
||||
};
|
||||
formFactor = lib.mkOption {
|
||||
type = lib.types.enum [ "laptop" "desktop" ];
|
||||
@@ -120,7 +124,11 @@ in
|
||||
monospace = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = schema.home.font;
|
||||
description = "System monospace font.";
|
||||
description = ''
|
||||
System monospace font. This is the declarative source of truth.
|
||||
Changing this and running `nomarchy-env-update` (or a system
|
||||
rebuild) will update the entire desktop.
|
||||
'';
|
||||
};
|
||||
};
|
||||
iconsTheme = lib.mkOption {
|
||||
|
||||
@@ -28,36 +28,18 @@ let
|
||||
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.
|
||||
# can override the value. The Nix options are now the declarative source
|
||||
# of truth. state.json is purely seeded to keep runtime scripts (menu,
|
||||
# summary) in sync with the Nix-level state.
|
||||
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);
|
||||
};
|
||||
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;
|
||||
themeName = cfg.theme;
|
||||
inherit assetsPath;
|
||||
});
|
||||
iconsTheme = lib.mkDefault (nomarchyLib.getIconsTheme {
|
||||
themeName = togglesState.theme or schema.home.theme;
|
||||
themeName = cfg.theme;
|
||||
inherit assetsPath;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -61,7 +61,10 @@ in
|
||||
theme = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = schema.system.theme;
|
||||
description = "Selected system theme.";
|
||||
description = ''
|
||||
Selected system theme. This is the declarative source of truth for
|
||||
system-level components (SDDM, Plymouth, browser policies).
|
||||
'';
|
||||
};
|
||||
|
||||
# ----- Tier 1 system features (all opt-in, no behavioural change off) ---
|
||||
|
||||
@@ -10,20 +10,8 @@ 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.
|
||||
# without colliding with the default values. The Nix options are now the
|
||||
# declarative source of truth.
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,7 +26,12 @@ mkdir -p "$STATE_DIR"
|
||||
if fc-list | grep -iq "$font_name"; then
|
||||
TMP_JSON=$(mktemp)
|
||||
jq --arg font "$font_name" '.font = $font' "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
||||
echo "Font set to $font_name declaratively. Applying changes..."
|
||||
echo "Font set to $font_name."
|
||||
echo "NOTE: This change is TEMPORARY and will be lost on the next system rebuild."
|
||||
echo "To make this font permanent, add the following to your /etc/nixos/home.nix:"
|
||||
echo " nomarchy.fonts.monospace = \"$font_name\";"
|
||||
echo ""
|
||||
echo "Applying changes with nomarchy-env-update..."
|
||||
|
||||
if [[ "$no_update" == "true" ]]; then
|
||||
echo "Skipping nomarchy-env-update due to --no-update flag."
|
||||
|
||||
@@ -53,7 +53,12 @@ if [ -d "$BG_DIR" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Theme set to $THEME_NAME. Applying changes with nomarchy-env-update..."
|
||||
echo "Theme set to $THEME_NAME."
|
||||
echo "NOTE: This change is TEMPORARY and will be lost on the next system rebuild."
|
||||
echo "To make this theme permanent, add the following to your /etc/nixos/home.nix:"
|
||||
echo " nomarchy.theme = \"$THEME_NAME\";"
|
||||
echo ""
|
||||
echo "Applying changes with nomarchy-env-update..."
|
||||
|
||||
if [[ "$NO_UPDATE" == "true" ]]; then
|
||||
echo "Skipping nomarchy-env-update due to --no-update flag."
|
||||
|
||||
Reference in New Issue
Block a user