Two clusters of documented-but-non-functional options surfaced during
the Pillar 8 audit, both setting toggles that have zero runtime effect.
1. `nomarchy.toggles.skipVsCodeTheme` was declared in
core/home/options.nix, defaulted from lib/state-schema.nix, and
surfaced as `NOMARCHY_TOGGLE_SKIP_VSCODE_THEME` env var in
features/scripts/default.nix — but `features/apps/vscode.nix` always
sets `workbench.colorTheme` unconditionally, and no script reads the
env var. Setting the toggle to true did nothing. Removed from
options, schema, state, env-var export, and OPTIONS.md.
2. `nomarchy.themeLoader.apps.{waybar,mako,kitty,alacritty}` were
declared in themes/engine/loader.nix but only `btop` is actually
wired (line 87 gates the per-theme btop.theme deploy). The other
four had no consumer. The actual theming pipeline for those apps is
elsewhere: waybar themes inline from `colorScheme` in waybar.nix;
kitty and alacritty are themed by stylix targets in
themes/engine/stylix.nix; mako has no theme integration at all.
Removed the four dead options + updated OPTIONS.md to list only
btop with a note about where the other apps' theming lives.
114 lines
4.1 KiB
Nix
114 lines
4.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
# Theme Loader Module
|
|
#
|
|
# This module handles loading and deploying theme-specific application configs.
|
|
# It reads the active theme from state and deploys configs from the theme's apps/
|
|
# subdirectory to appropriate locations.
|
|
#
|
|
# Theme structure expected:
|
|
# assets/themes/<theme-name>/
|
|
# ├── colors.toml # Color palette (required)
|
|
# ├── light.mode # Marker for light themes (optional)
|
|
# ├── icons.theme # Icon theme name
|
|
# ├── backgrounds/ # Wallpapers
|
|
# ├── apps/ # App-specific themed configs
|
|
# │ ├── alacritty.toml
|
|
# │ ├── kitty.conf
|
|
# │ ├── waybar.css
|
|
# │ ├── hyprland-colors.conf
|
|
# │ ├── mako.conf
|
|
# │ ├── swayosd.css
|
|
# │ ├── btop.theme
|
|
# │ ├── vscode.json
|
|
# │ └── neovim.lua
|
|
# └── preview.png
|
|
|
|
let
|
|
nomarchyLib = import ../../lib { inherit lib; };
|
|
assetsPath = ../palettes;
|
|
activeTheme = config.nomarchy.theme;
|
|
themePath = assetsPath + "/${activeTheme}";
|
|
themeAppsPath = themePath + "/apps";
|
|
|
|
# Check if a theme has an apps directory
|
|
themeHasApps = builtins.pathExists themeAppsPath;
|
|
|
|
# Get the color palette for template processing
|
|
palette = nomarchyLib.getPalette activeTheme;
|
|
|
|
# Helper to check if a file exists in theme
|
|
hasThemeFile = name: builtins.pathExists (themePath + "/${name}");
|
|
hasThemeAppFile = name: themeHasApps && builtins.pathExists (themeAppsPath + "/${name}");
|
|
|
|
# All app configs are now in apps/ subdirectory
|
|
# Legacy root-level files are no longer supported
|
|
|
|
in
|
|
{
|
|
options.nomarchy.themeLoader = {
|
|
enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Whether to enable automatic theme app config loading.";
|
|
};
|
|
|
|
apps = {
|
|
# waybar, kitty, alacritty, and mako are intentionally absent. Waybar
|
|
# themes inline in features/desktop/waybar via colorScheme; kitty and
|
|
# alacritty are themed by stylix targets (themes/engine/stylix.nix); mako
|
|
# has no theme integration yet. Only btop is loaded from the active
|
|
# theme's apps/ directory.
|
|
btop = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Whether to load btop theme from active theme.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.nomarchy.themeLoader.enable {
|
|
# Deploy btop theme if available in apps/
|
|
xdg.configFile."btop/themes/nomarchy.theme" = lib.mkIf (config.nomarchy.themeLoader.apps.btop && hasThemeAppFile "btop.theme") {
|
|
source = lib.mkDefault (themeAppsPath + "/btop.theme");
|
|
};
|
|
|
|
# Note: Waybar CSS is generated inline in waybar.nix using colorScheme
|
|
# This loader would be used if themes provide complete waybar.css overrides
|
|
# For now, theme waybar.css files are only used for themes that need
|
|
# significantly different styling (like retro-82)
|
|
|
|
# Create theme info file for scripts
|
|
xdg.configFile."nomarchy/theme-loader/current".text = ''
|
|
THEME_NAME="${activeTheme}"
|
|
THEME_PATH="${toString themePath}"
|
|
THEME_HAS_APPS="${if themeHasApps then "true" else "false"}"
|
|
IS_LIGHT_MODE="${if config.nomarchy.isLightMode then "true" else "false"}"
|
|
ICONS_THEME="${config.nomarchy.iconsTheme}"
|
|
'';
|
|
|
|
# Expose palette as shell-sourceable file for scripts
|
|
xdg.configFile."nomarchy/theme-loader/palette.sh".text = ''
|
|
# Auto-generated palette for ${activeTheme}
|
|
# Source this file in scripts to get theme colors
|
|
|
|
BASE00="${palette.base00}"
|
|
BASE01="${palette.base01}"
|
|
BASE02="${palette.base02}"
|
|
BASE03="${palette.base03}"
|
|
BASE04="${palette.base04}"
|
|
BASE05="${palette.base05}"
|
|
BASE06="${palette.base06}"
|
|
BASE07="${palette.base07}"
|
|
BASE08="${palette.base08}"
|
|
BASE09="${palette.base09}"
|
|
BASE0A="${palette.base0A}"
|
|
BASE0B="${palette.base0B}"
|
|
BASE0C="${palette.base0C}"
|
|
BASE0D="${palette.base0D}"
|
|
BASE0E="${palette.base0E}"
|
|
BASE0F="${palette.base0F}"
|
|
'';
|
|
};
|
|
}
|