From d708b433955c6d7e4f57040e0688541a2b670780 Mon Sep 17 00:00:00 2001 From: autumn-the-kitty-cat Date: Thu, 18 Dec 2025 04:02:04 -0500 Subject: [PATCH] feat: switch theme with nix specialisations --- home/pc/common/home.nix | 11 +++- host/pc/common/stylix.nix | 128 ++++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 68 deletions(-) diff --git a/home/pc/common/home.nix b/home/pc/common/home.nix index 8a67d7f..b5ab577 100644 --- a/home/pc/common/home.nix +++ b/home/pc/common/home.nix @@ -2,15 +2,14 @@ { imports = [ inputs.nixvim.homeModules.nixvim - inputs.stylix.homeModules.stylix inputs.zen-browser.homeModules.default + #inputs.stylix.homeModules.stylix ./programs ./clangd.nix ./hyprland.nix ./packages.nix - ./stylix.nix ./xdg.nix ]; @@ -18,6 +17,14 @@ home.homeDirectory = "/home/autumn"; home.stateVersion = "25.05"; + stylix = { + targets.waybar.enable = false; + targets.zathura.enable = false; + targets.vesktop.enable = false; + targets.zen-browser.profileNames = [ "default" ]; + targets.gnome.enable = false; + }; + nixpkgs.config = { allowUnfree = true; allowUnfreePredicate = _: true; diff --git a/host/pc/common/stylix.nix b/host/pc/common/stylix.nix index eb98a55..28ea24c 100644 --- a/host/pc/common/stylix.nix +++ b/host/pc/common/stylix.nix @@ -1,78 +1,74 @@ { inputs, pkgs, + lib, ... }: -{ - stylix = +let + jsonSchemes = pkgs.stdenv.mkDerivation { + name = "fromYAML"; + phases = "buildPhase"; + buildPhase = '' + mkdir -p $out/ + for FILE in ${pkgs.base16-schemes}/share/themes/*; do + FILEBASENAME="$(basename $FILE .yaml).json" + cat $FILE | ${pkgs.yaml2json}/bin/yaml2json | sed s/#//g > $out/$FILEBASENAME + done + ls -l $out/ + ''; + }; + + json2Palette = + jsonScheme: (builtins.fromJSON (builtins.readFile "${jsonSchemes}/${jsonScheme}.json")).palette; + + font = { + package = pkgs.nerd-fonts.caskaydia-cove; + name = "CaskaydiaCove Nerd Font"; + }; + + makeTheme = + jsonScheme: polarity: let - palette = { - base00 = "11111a"; # #11111a - base01 = "181825"; # #181825 - base02 = "313244"; # #313244 - base03 = "45475a"; # #45475a - base04 = "585b70"; # #585b70 - base05 = "cdd6f4"; # #cdd6f4 - base06 = "f5e0dc"; # #f5e0dc - base07 = "b4befe"; # #b4befe - base08 = "f38ba8"; # #f38ba8 - base09 = "fab387"; # #fab387 - base0A = "f9e2af"; # #f9e2af - base0B = "a6e3a1"; # #a6e3a1 - base0C = "94e2d5"; # #94e2d5 - base0D = "f5c2e7"; # #f5c2e7 - base0E = "cba6f7"; # #cba6f7 - base0F = "f2cdcd"; # #f2cdcd - - #base00 = "1d2021"; # #1d2021 - #base01 = "3c3836"; # #3c3836 - #base02 = "504945"; # #504945 - #base03 = "665c54"; # #665c54 - #base04 = "bdae93"; # #bdae93 - #base05 = "d5c4a1"; # #d5c4a1 - #base06 = "ebdbb2"; # #ebdbb2 - #base07 = "fbf1c7"; # #fbf1c7 - #base08 = "fb4934"; # #fb4934 - #base09 = "fe8019"; # #fe8019 - #base0A = "fabd2f"; # #fabd2f - #base0B = "b8bb26"; # #b8bb26 - #base0C = "8ec07c"; # #8ec07c - #base0D = "83a598"; # #83a598 - #base0E = "d3869b"; # #d3869b - #base0F = "d65d0e"; # #d65d0e - }; - wallpaper = inputs.nix-wallpaper.packages.${pkgs.stdenv.hostPlatform.system}.default.override { - width = 2560; - height = 1440; - backgroundColor = "#${palette.base00}"; - logoColors = { - color0 = "#${palette.base0D}"; - color1 = "#${palette.base0D}"; - color2 = "#${palette.base0D}"; - color3 = "#${palette.base0D}"; - color4 = "#${palette.base0D}"; - color5 = "#${palette.base0D}"; - }; - }; + palette = json2Palette jsonScheme; in - { enable = true; - image = "${wallpaper}/share/wallpapers/nixos-wallpaper.png"; - polarity = "dark"; - fonts = - let - font = { - package = pkgs.nerd-fonts.caskaydia-cove; - name = "CaskaydiaCove Nerd Font"; - }; - in - { - monospace = font; - serif = font; - sansSerif = font; - emoji = font; - }; base16Scheme.palette = palette; + inherit polarity; + fonts = { + emoji = font; + monospace = font; + sansSerif = font; + serif = font; + }; + image = + let + wallpaper = inputs.nix-wallpaper.packages.${pkgs.stdenv.hostPlatform.system}.default.override { + width = 2560; + height = 1440; + backgroundColor = "#${palette.base00}"; + logoColors = { + color0 = "#${palette.base0D}"; + color1 = "#${palette.base0D}"; + color2 = "#${palette.base0D}"; + color3 = "#${palette.base0D}"; + color4 = "#${palette.base0D}"; + color5 = "#${palette.base0D}"; + }; + }; + + in + "${wallpaper}/share/wallpapers/nixos-wallpaper.png"; }; + +in +{ + stylix = makeTheme "catppuccin-mocha" "dark"; + + specialisation = { + catppuccin-mocha.configuration.stylix = lib.mkForce (makeTheme "catppuccin-mocha" "dark"); + catppuccin-latte.configuration.stylix = lib.mkForce (makeTheme "catppuccin-latte" "light"); + gruvbox-dark-hard.configuration.stylix = lib.mkForce (makeTheme "gruvbox-dark-hard" "dark"); + heetch.configuration.stylix = lib.mkForce (makeTheme "heetch" "dark"); + }; }