Files
nixos/Droidnix/generated/parked/desktop/stylix.nix
T
2026-03-21 19:47:47 +00:00

66 lines
1.7 KiB
Nix

{ lib, config, ... }:
let
# --- Module variables ---
moduleName = "stylix";
username = config.defaultUser or "henrov";
# Assets directory for Stylix config
assetPath = ../../../assets/system/conf/${moduleName};
# Read all config files
programFiles = builtins.readDir assetPath;
files = lib.genAttrs (builtins.attrNames programFiles) (name: {
src = "${assetPath}/${name}";
});
# Top-level toggle for this module
enableProgram = config.enableStylix or false;
# Read the main stylix.conf
stylixConfFile = "${assetPath}/stylix.conf";
stylixConf = if builtins.pathExists stylixConfFile
then builtins.readFile stylixConfFile
else "";
# Default cursor values
cursorName = "phinger-cursors-light";
cursorSize = 24;
in
{
# --- Top-level toggle ---
options.enableStylix = lib.mkEnableOption "Enable Stylix system theming";
# --- Only apply configuration if enabled ---
config = lib.mkIf enableProgram {
# Deploy Stylix configuration files to user's XDG config
home-manager.users.${username}.xdg.configFile =
lib.mapAttrs' (name: value: {
name = "${moduleName}/${name}";
value.source = value.src;
}) files;
# Merge all session variables into a single map
home-manager.users.${username}.home.sessionVariables = lib.mkMerge [
{
STYLIX_CONF = stylixConf;
}
{
XCURSOR_THEME = cursorName;
XCURSOR_SIZE = toString cursorSize;
HYPRCURSOR_THEME = cursorName;
HYPRCURSOR_SIZE = toString cursorSize;
}
];
# Optional wallpaper helper packages (symbolic, install manually or via packages)
environment.systemPackages = [
"feh"
"st"
];
};
}