Files
nixos/Droidnix/generated/modules/desktop/stylix.nix
T
2026-03-19 20:42:33 +00:00

70 lines
2.1 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 "";
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;
# Provide stylix.conf content as an environment variable (or for further init scripts)
home-manager.users.${username}.home.sessionVariables = {
STYLIX_CONF = stylixConf;
};
# Optional wallpaper helper packages (symbolic, install manually or via packages)
environment.systemPackages = [
# symbolic references, actual pkgs mapping done elsewhere
"feh"
"st"
];
# Cursor environment variables (read from stylix.conf if needed)
# Minimal example using defaults from your stylix.conf
home-manager.users.${username}.home.sessionVariables = lib.mkForce (
let
# Default cursor values if stylix.conf parsing not implemented
cursorName = "phinger-cursors-light";
cursorSize = 24;
in {
XCURSOR_THEME = cursorName;
XCURSOR_SIZE = toString cursorSize;
HYPRCURSOR_THEME = cursorName;
HYPRCURSOR_SIZE = toString cursorSize;
}
);
};
}