Files
faumaray 079cceb554 update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-10-29 16:02:14 +03:00

175 lines
6.5 KiB
Nix

# Theme: one palette, fonts, cursor, icons and wallpaper for the whole desktop,
# applied by Stylix (github:nix-community/stylix).
# NixOS Stylix itself (its home-manager module is added to every
# home-manager user and inherits these settings): palette,
# fonts, cursor, icons, the wallpaper image, and the system
# targets (TTY palette, fontconfig, GTK, Qt).
# home-manager the programs Stylix themes, and the targets switched off.
# Targets are opt-out (`autoEnable = true`): Stylix themes every program it
# supports. A target that clashes with this desktop is switched off by name in
# the home-manager half; so is a program whose theming is not wanted.
{ config, inputs, ... }:
let
inherit (config.meta) owner;
hmTheme = config.flake.modules.homeManager.theme;
in
{
flake.modules.nixos.theme =
{ pkgs, ... }:
{
imports = [ inputs.stylix.nixosModules.stylix ];
home-manager.users.${owner.name}.imports = [ hmTheme ];
stylix = {
enable = true;
# Stylix themes everything it supports, so it also writes GNOME, KDE, X
# resources, gedit, gdu, Blender, ... configs and rebuilds gtksourceview
# through an overlay. The exceptions are the `enable = false` lines in
# the home-manager half below.
autoEnable = true;
polarity = "dark";
# Catppuccin Mocha, from tinted-theming/schemes base16/catppuccin-mocha.yaml.
# Inline, so the scheme needs no import-from-derivation. Another scheme:
# base16Scheme = "${pkgs.base16-schemes}/share/themes/<name>.yaml";
base16Scheme = {
scheme = "Catppuccin Mocha";
author = "https://github.com/catppuccin/catppuccin";
slug = "catppuccin-mocha";
variant = "dark";
base00 = "1e1e2e"; # base
base01 = "181825"; # mantle
base02 = "313244"; # surface0
base03 = "45475a"; # surface1
base04 = "585b70"; # surface2
base05 = "cdd6f4"; # text
base06 = "f5e0dc"; # rosewater
base07 = "b4befe"; # lavender
base08 = "f38ba8"; # red
base09 = "fab387"; # peach
base0A = "f9e2af"; # yellow
base0B = "a6e3a1"; # green
base0C = "94e2d5"; # teal
base0D = "89b4fa"; # blue
base0E = "cba6f7"; # mauve
base0F = "f2cdcd"; # flamingo
};
# The desktop wallpaper, set in this one place. Noctalia draws it
# (desktop/noctalia.nix reads it) and the SDDM login screen shows it
# (desktop/sddm.nix). To change it, point this at another image: a file
# next to this one (`./wallpaper.png`) or a `pkgs.fetchurl { url; hash; }`.
# The colours do not follow it: base16Scheme above is explicit. The
# Stylix targets that would draw the wallpaper themselves are off in the
# home-manager half, so Noctalia stays the only one.
image = pkgs.nixos-artwork.wallpapers.catppuccin-mocha.gnomeFilePath;
fonts = {
monospace = {
package = pkgs.monaspace;
name = "Monaspace Radon";
};
sansSerif = {
package = pkgs.monaspace;
name = "Monaspace Radon";
};
serif = {
package = pkgs.noto-fonts;
name = "Noto Serif";
};
emoji = {
package = pkgs.noto-fonts-color-emoji;
name = "Noto Color Emoji";
};
};
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
};
icons = {
enable = true;
package = pkgs.papirus-icon-theme;
dark = "Papirus-Dark";
light = "Papirus-Light";
};
targets = {
# On through autoEnable anyway; listed for what each one is for.
# TTY palette (vt.default_{red,grn,blu} kernel parameters).
console.enable = true;
# fontconfig default families from `fonts` above, and their packages.
fontconfig.enable = true;
font-packages.enable = true;
# programs.dconf, which home-manager's GTK settings need.
gtk.enable = true;
qt.enable = true;
};
};
};
flake.modules.homeManager.theme = {
stylix.targets = {
gtk = {
enable = true;
# No Flatpak here: do not write ~/.themes or Flatpak overrides.
flatpakSupport.enable = false;
};
qt.enable = true;
hyprland = {
enable = true;
# With `stylix.image` set, Stylix would also start hyprpaper to draw it.
hyprpaper.enable = false;
};
noctalia = {
enable = true;
# Keep Noctalia's own panel opacities and the shell font chosen for it.
opacity.enable = false;
fonts.override.sansSerif.name = "Monaspace Krypton";
};
wezterm = {
enable = true;
fonts.override.monospace.name = "Monaspace Radon";
};
bat.enable = true;
btop.enable = true;
fzf.enable = true;
starship.enable = true;
mpv.enable = true;
zathura.enable = true;
# Writes the palette as a CSS snippet and the fonts into the vaults listed
# here; the name is the vault's attribute in desktop/obsidian.nix.
obsidian = {
enable = true;
vaultNames = [ "Notes" ];
};
# Switched off although autoEnable would turn them on:
# - gnome.image, kde.useWallpaper: with `stylix.image` set they would
# write the wallpaper into GNOME's dconf and KDE's theme; neither
# desktop runs here and Noctalia draws the wallpaper.
# - neovim: themed by the owner's nvim repository (inputs.nvim,
# modules/cli/neovim.nix), which picks its own colorscheme
# (silkcircuit); Stylix's mini.base16 would be added on top of it.
# - firefox: needs a declared profile (programs.firefox.profiles);
# declaring one would replace the existing Firefox profile, so the
# target only warns about the missing profileNames.
# - rofi: not installed; the pinned Stylix target still sets the renamed
# `programs.rofi.font` and warns on every evaluation.
gnome.image.enable = false;
kde.useWallpaper = false;
neovim.enable = false;
firefox.enable = false;
rofi.enable = false;
};
# libadwaita/GTK 4 apps read the preference from dconf.
gtk.colorScheme = "dark";
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
}