{ config, inputs, lib, pkgs, ... }: let inherit (lib) mkEnableOption mkOption mkIf; inherit (lib) optionalAttrs; inherit (lib.types) bool str; cfg = config.module.stylix; fromBase16Schemes = f: "${pkgs.base16-schemes}/share/themes/${f}.yaml"; interPackage = pkgs.inter; iosevkaPackage = pkgs.nerd-fonts.iosevka; iosevkaTermPackage = pkgs.nerd-fonts.iosevka-term; mesloLgPackage = pkgs.nerd-fonts.meslo-lg; # jetBrainsMonoPackage = pkgs.nerd-fonts.jetbrains-mono; geistMonoPackage = pkgs.nerd-fonts.geist-mono; geistPackage = pkgs.geist-font; wallpapers = import ./wallpapers.nix; interIosevka = { serif = { package = interPackage; name = "Inter"; }; monospace = { package = iosevkaTermPackage; name = "IosevkaTerm Nerd Font Mono"; }; }; themes = { dark = { ashes = { polarity = "dark"; base16Scheme = fromBase16Schemes "classic-dark"; image = wallpapers.abstract.lambda; inherit (interIosevka) serif monospace; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; rose-pine-moon = { polarity = "dark"; base16Scheme = fromBase16Schemes "rose-pine-moon"; image = wallpapers.cyber-dawn; inherit (interIosevka) serif monospace; cursor = { package = pkgs.nordzy-cursor-theme; name = "Nordzy-cursors"; size = 24; }; }; rose-pine = { polarity = "dark"; base16Scheme = fromBase16Schemes "rose-pine"; image = wallpapers.cyber-dawn; inherit (interIosevka) serif monospace; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; kanagawa = { polarity = "dark"; base16Scheme = fromBase16Schemes "kanagawa"; image = wallpapers.cyber-dawn; inherit (interIosevka) serif monospace; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; sandcastle = { polarity = "dark"; base16Scheme = fromBase16Schemes "sandcastle"; image = wallpapers.abstract.waves; serif = { package = geistPackage; name = "Geist"; }; monospace = { package = geistMonoPackage; name = "GeistMono NFM"; }; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; gruvbox-dark-pale = { polarity = "dark"; base16Scheme = fromBase16Schemes "gruvbox-dark-pale"; image = wallpapers.mountains-sepia; serif = { package = geistPackage; name = "Geist"; }; monospace = { package = geistMonoPackage; name = "GeistMono Nerd Font"; }; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; nord = { polarity = "dark"; base16Scheme = fromBase16Schemes "nord"; image = builtins.fetchurl { url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; name = "wallhaven-l8l9gq.png"; sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; }; inherit (interIosevka) serif monospace; cursor = { package = pkgs.nordzy-cursor-theme; name = "Nordzy-cursors"; size = 32; }; }; helios = { polarity = "dark"; base16Scheme = fromBase16Schemes "helios"; image = builtins.fetchurl { url = "https://w.wallhaven.cc/full/lq/wallhaven-lqorw2.png"; name = "wallhaven-lqorw2.png"; sha256 = "sha256:1rjchjq4pc2jyq8dvpa17mmscv9qcm0h0zv468lsf8s51anpid6p"; }; inherit (interIosevka) serif monospace; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; sulphurpool = { polarity = "dark"; base16Scheme = fromBase16Schemes "atelier-sulphurpool"; image = builtins.fetchurl { url = "https://w.wallhaven.cc/full/rd/wallhaven-rd5q3m.jpg"; name = "wallhaven-rd5q3m.jpg"; sha256 = "sha256:1sa2739vwwv1xafzjvxlg3kvq26xmcxg6hrwq29q40j617r63sy6"; }; serif = { package = interPackage; name = "Inter Nerd Font"; }; monospace = { package = iosevkaTermPackage; name = "IosevkaTerm Nerd Font Mono"; }; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; vesper = { polarity = "dark"; base16Scheme = fromBase16Schemes "vesper"; image = wallpapers.abstract.squares; serif = { package = geistPackage; name = "Geist"; }; monospace = { package = geistMonoPackage; name = "GeistMono Nerd Font"; }; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Classic"; size = 24; }; }; }; light = { rose-pine-dawn = { polarity = "light"; base16Scheme = fromBase16Schemes "rose-pine-dawn"; image = wallpapers.cyber-dawn; serif = { package = iosevkaPackage; name = "Iosevka Nerd Font Propo"; }; monospace = { package = iosevkaTermPackage; name = "IosevkaTerm Nerd Font Mono"; }; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Ice"; size = 24; }; nord-light = { polarity = "light"; base16Scheme = fromBase16Schemes "nord-light"; image = builtins.fetchurl { url = "https://w.wallhaven.cc/full/l8/wallhaven-l8l9gq.png"; name = "wallhaven-l8l9gq.png"; sha256 = "0ypr44sg0fn55m1b52dgr1nnscpi2p6rfkjsm7vvrdqw7bafbx2z"; }; serif = { package = iosevkaPackage; name = "Iosevka Nerd Font Propo"; }; monospace = { package = iosevkaTermPackage; name = "IosevkaTerm Nerd Font Mono"; }; cursor = { package = pkgs.nordzy-cursor-theme; name = "Nordzy-cursors-white"; size = 32; }; }; }; himalaya = { # lightly pink like himalayan salt polarity = "light"; base16Scheme = fromBase16Schemes "atelier-plateau-light"; image = wallpapers.mountains-pink; serif = { package = interPackage; name = "Inter Nerd Font"; }; monospace = { package = mesloLgPackage; name = "MesloLGM Nerd Font Mono"; }; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Ice"; size = 24; }; }; github = { polarity = "light"; base16Scheme = fromBase16Schemes "github"; image = wallpapers.abstract.squares; serif = { package = geistPackage; name = "Geist Light"; }; monospace = { package = geistMonoPackage; name = "GeistMono Nerd Font"; }; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Ice"; size = 24; }; }; }; }; in { imports = with inputs; [ stylix.nixosModules.stylix ]; options = { module.stylix = { enable = mkEnableOption "enable stylix"; useCursor = mkOption { type = bool; default = true; description = "enable cursor settings"; }; theme = mkOption { type = str; default = "nord"; }; polarity = mkOption { type = lib.types.enum ["dark" "light"]; default = "dark"; }; }; }; config = mkIf cfg.enable { fonts.packages = [pkgs.nerd-fonts.symbols-only]; stylix = let theme = themes.${cfg.polarity}.${cfg.theme}; in { autoEnable = true; enable = true; # TODO: disable when stylix updates enableReleaseChecks = false; inherit (cfg) polarity; inherit (theme) # image base16Scheme ; image = null; targets.gtksourceview.enable = false; opacity = { applications = 1.0; terminal = 1.0; popups = 1.0; desktop = 1.0; }; fonts = { sizes = { applications = 13; terminal = 13; popups = 14; desktop = 13; }; inherit (theme) serif monospace; sansSerif = config.stylix.fonts.serif; emoji = config.stylix.fonts.serif; }; } // optionalAttrs cfg.useCursor { cursor = { inherit (theme.cursor) package name size; }; }; }; }