369 lines
8.6 KiB
Nix
369 lines
8.6 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.theme;
|
|
init = pkgs.writeShellApplication {
|
|
name = "theme";
|
|
runtimeInputs = with pkgs; [ coreutils-full ];
|
|
bashOptions = [ "nounset" "pipefail" ];
|
|
runtimeEnv = {
|
|
CONFIG = cfg.configDir;
|
|
DEFAULT_WALLPAPER = cfg.wallpaper;
|
|
DEFAULT_MODE = cfg.mode;
|
|
SWITCH = lib.meta.getExe (pkgs.writeShellScriptBin "themeExtraConfig" cfg.extraConfig);
|
|
};
|
|
text = builtins.readFile ./theme.sh;
|
|
};
|
|
in
|
|
{
|
|
# https://github.com/Theaninova/TheaninovOS/blob/master/modules/home-manager/theme/md3-evo.nix
|
|
options.theme = with lib; with types; {
|
|
enable = mkEnableOption "theme";
|
|
|
|
configDir = mkOption {
|
|
type = str;
|
|
default = "${config.xdg.configHome}/theme";
|
|
description = "The path to the theme config directory.";
|
|
};
|
|
|
|
wallpaper = mkOption {
|
|
type = path;
|
|
description = "The path to the default wallpaper";
|
|
};
|
|
|
|
pkg = mkOption {
|
|
type = package;
|
|
default = init;
|
|
readOnly = true;
|
|
description = "The package containing the `theme` script";
|
|
};
|
|
|
|
extraConfig = mkOption {
|
|
type = lines;
|
|
default = "";
|
|
description = "Extra configuration lines to add to the theme script.";
|
|
};
|
|
|
|
flavour = mkOption {
|
|
type = enum [
|
|
"content"
|
|
"expressive"
|
|
"fidelity"
|
|
"fruit-salad"
|
|
"monochrome"
|
|
"neutral"
|
|
"rainbow"
|
|
"tonal-spot"
|
|
];
|
|
default = "tonal-spot";
|
|
description = "The flavour of the theme.";
|
|
};
|
|
|
|
mode = mkOption {
|
|
type = enum [ "dark" "light" ];
|
|
default = "dark";
|
|
description = "The default mode of the theme.";
|
|
};
|
|
|
|
contrast = mkOption {
|
|
type = numbers.between (-1) 1;
|
|
default = 0;
|
|
description = "Use a modified contrast.";
|
|
};
|
|
|
|
opacity = mkOption {
|
|
type = numbers.between 0 1;
|
|
default = 1;
|
|
description = "The opacity of apps.";
|
|
};
|
|
|
|
radius = mkOption {
|
|
type = ints.unsigned;
|
|
default = 8;
|
|
description = "The radius of corners.";
|
|
};
|
|
|
|
padding = mkOption {
|
|
type = ints.unsigned;
|
|
default = 8;
|
|
description = "The padding of windows.";
|
|
};
|
|
|
|
blur = mkOption {
|
|
type = ints.unsigned;
|
|
default = 0;
|
|
description = "The blur amount of windows.";
|
|
};
|
|
|
|
color = {
|
|
semantic = {
|
|
blend = mkOption {
|
|
type = bool;
|
|
default = false;
|
|
description = "Blend the colors.";
|
|
};
|
|
|
|
danger = mkOption {
|
|
type = str;
|
|
default = "#ff0000";
|
|
description = "The color of danger.";
|
|
};
|
|
|
|
warning = mkOption {
|
|
type = str;
|
|
default = "#ffff00";
|
|
description = "The color of warning.";
|
|
};
|
|
|
|
success = mkOption {
|
|
type = str;
|
|
default = "#00ff00";
|
|
description = "The color of success.";
|
|
};
|
|
|
|
info = mkOption {
|
|
type = str;
|
|
default = "#0000ff";
|
|
description = "The color of info.";
|
|
};
|
|
};
|
|
|
|
syntax = {
|
|
blend = mkOption {
|
|
type = bool;
|
|
default = true;
|
|
description = "Blend the colors.";
|
|
};
|
|
|
|
keywords = mkOption {
|
|
type = str;
|
|
default = "#ff8000";
|
|
description = "The color of keywords.";
|
|
};
|
|
|
|
functions = mkOption {
|
|
type = str;
|
|
default = "#0000ff";
|
|
description = "The color of functions.";
|
|
};
|
|
|
|
properties = mkOption {
|
|
type = str;
|
|
default = "#ff00ff";
|
|
description = "The color of properties.";
|
|
};
|
|
|
|
constants = mkOption {
|
|
type = str;
|
|
default = "#ff00ff";
|
|
description = "The color of constants.";
|
|
};
|
|
|
|
strings = mkOption {
|
|
type = str;
|
|
default = "#00ff00";
|
|
description = "The color of variables.";
|
|
};
|
|
|
|
numbers = mkOption {
|
|
type = str;
|
|
default = "#00ffff";
|
|
description = "The color of numbers.";
|
|
};
|
|
|
|
structures = mkOption {
|
|
type = str;
|
|
default = "#ffff00";
|
|
description = "The color of structures.";
|
|
};
|
|
|
|
types = mkOption {
|
|
type = str;
|
|
default = "#00ffff";
|
|
description = "The color of types.";
|
|
};
|
|
};
|
|
|
|
ansi = {
|
|
blend = mkOption {
|
|
type = bool;
|
|
default = true;
|
|
description = "Blend the colors.";
|
|
};
|
|
|
|
red = mkOption {
|
|
type = str;
|
|
default = "#ff0000";
|
|
description = "The color of red.";
|
|
};
|
|
|
|
green = mkOption {
|
|
type = str;
|
|
default = "#00ff00";
|
|
description = "The color of green.";
|
|
};
|
|
|
|
yellow = mkOption {
|
|
type = str;
|
|
default = "#ffff00";
|
|
description = "The color of yellow.";
|
|
};
|
|
|
|
orange = mkOption {
|
|
type = str;
|
|
default = "#ff8000";
|
|
description = "The color of orange.";
|
|
};
|
|
|
|
blue = mkOption {
|
|
type = str;
|
|
default = "#0000ff";
|
|
description = "The color of blue.";
|
|
};
|
|
|
|
magenta = mkOption {
|
|
type = str;
|
|
default = "#ff00ff";
|
|
description = "The color of magenta.";
|
|
};
|
|
|
|
cyan = mkOption {
|
|
type = str;
|
|
default = "#00ffff";
|
|
description = "The color of cyan.";
|
|
};
|
|
};
|
|
};
|
|
|
|
font = {
|
|
sansSerif = {
|
|
names = mkOption {
|
|
type = listOf str;
|
|
default = [ "Roboto" ];
|
|
description = "The sans serif font families.";
|
|
};
|
|
|
|
packages = mkOption {
|
|
type = listOf package;
|
|
default = with pkgs; [ roboto ];
|
|
description = "The sans serif font packages.";
|
|
};
|
|
};
|
|
|
|
serif = {
|
|
names = mkOption {
|
|
type = listOf str;
|
|
default = [ "Roboto Serif" ];
|
|
description = "The serif font families.";
|
|
};
|
|
|
|
packages = mkOption {
|
|
type = listOf package;
|
|
default = with pkgs; [ roboto-serif ];
|
|
description = "The serif font packages.";
|
|
};
|
|
};
|
|
|
|
monospace = {
|
|
names = mkOption {
|
|
type = listOf str;
|
|
default = [ "JetBrainsMono Nerd Font" ];
|
|
description = "The monospace font families.";
|
|
};
|
|
|
|
packages = mkOption {
|
|
type = listOf package;
|
|
default = with pkgs; [ (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) ];
|
|
description = "The monospace font packages.";
|
|
};
|
|
};
|
|
|
|
emoji = {
|
|
names = mkOption {
|
|
type = listOf str;
|
|
default = [ "Noto Emoji" "Font Awesome" ];
|
|
description = "The emoji font families.";
|
|
};
|
|
|
|
packages = mkOption {
|
|
type = listOf package;
|
|
default = with pkgs; [ noto-fonts-color-emoji font-awesome ];
|
|
description = "The emoji font packages.";
|
|
};
|
|
};
|
|
|
|
size = mkOption {
|
|
type = ints.positive;
|
|
default = 12;
|
|
description = "The font size.";
|
|
};
|
|
};
|
|
|
|
icon = {
|
|
names = mkOption {
|
|
type = listOf str;
|
|
default = [ "Adwaita" ];
|
|
description = "The icon theme names.";
|
|
};
|
|
|
|
packages = mkOption {
|
|
type = listOf package;
|
|
default = with pkgs; [
|
|
adwaita-icon-theme
|
|
nixos-icons
|
|
];
|
|
description = "The icon theme packages.";
|
|
};
|
|
};
|
|
|
|
cursor = {
|
|
names = mkOption {
|
|
type = listOf str;
|
|
default = [ "Adwaita" ];
|
|
description = "The cursor names.";
|
|
};
|
|
|
|
packages = mkOption {
|
|
type = listOf package;
|
|
default = with pkgs; [ adwaita-icon-theme ];
|
|
description = "The cursor theme packages.";
|
|
};
|
|
|
|
size = mkOption {
|
|
type = ints.positive;
|
|
default = 32;
|
|
description = "The cursor size.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home = {
|
|
packages =
|
|
[ cfg.pkg ] ++
|
|
cfg.font.sansSerif.packages ++
|
|
cfg.font.serif.packages ++
|
|
cfg.font.monospace.packages ++
|
|
cfg.font.emoji.packages ++
|
|
cfg.icon.packages ++
|
|
cfg.cursor.packages;
|
|
|
|
pointerCursor = {
|
|
name = builtins.head cfg.cursor.names;
|
|
package = builtins.head cfg.cursor.packages;
|
|
inherit (cfg.cursor) size;
|
|
};
|
|
};
|
|
|
|
fonts.fontconfig = {
|
|
enable = true;
|
|
defaultFonts = {
|
|
sansSerif = cfg.font.sansSerif.names;
|
|
serif = cfg.font.serif.names;
|
|
monospace = cfg.font.monospace.names;
|
|
emoji = cfg.font.emoji.names;
|
|
};
|
|
};
|
|
};
|
|
}
|