diff --git a/home/common/default.nix b/home/common/default.nix index 29f2932..2f9c8e2 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -4,5 +4,6 @@ ./wm ./nodm.nix ./nix.nix + ./theme.nix ]; } diff --git a/home/common/theme.nix b/home/common/theme.nix new file mode 100644 index 0000000..3d28c59 --- /dev/null +++ b/home/common/theme.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.nixfiles.theming; + + mkCtpPackages = flavor: accent: let + toCaps = s: with lib.strings; with builtins; + (toUpper (substring 0 1 s)) + toLower (substring 1 ((stringLength s)-1) s); + inherit (lib.strings) toUpper toLower; + in with pkgs; { + cursors = catppuccin-cursors."${toLower flavor}${toCaps accent}"; + cursorName = "Catppuccin-${toCaps flavor}-${toCaps accent}-Cursors"; + kvantum = catppuccin-kvantum.override { variant = toCaps flavor; accent = toCaps accent; }; + icons = catppuccin-papirus-folders.override { flavor = toLower flavor; accent = toLower accent; }; + }; + + ctpPackages = with cfg.catppuccin; mkCtpPackages flavor accent; +in { + options.nixfiles.theming = { + enable = lib.mkEnableOption "nixfiles theming options"; + catppuccin = { + flavor = lib.mkOption { + description = "Catppuccin flavor"; + type = lib.types.str; + default = "mocha"; + }; + accent = lib.mkOption { + description = "Catppuccin accent"; + type = lib.types.str; + default = "mauve"; + }; + }; + }; + + config = lib.mkIf cfg.enable { + gtk.enable = true; + + home.pointerCursor = { + package = lib.mkDefault ctpPackages.cursors; + name = lib.mkDefault ctpPackages.cursorName; + size = lib.mkDefault 24; + x11.enable = lib.mkDefault true; + gtk.enable = lib.mkDefault true; + }; + }; +} diff --git a/home/common/wm/default.nix b/home/common/wm/default.nix index 1e02cb7..7c97252 100644 --- a/home/common/wm/default.nix +++ b/home/common/wm/default.nix @@ -22,6 +22,8 @@ in # Common options for standalone window managers; many of these (or # alternatives thereof) are pulled in by desktop environments. + nixfiles.theming.enable = lib.mkDefault true; + qt.enable = true; qt.platformTheme.name = "qtct"; qt.style.name = "kvantum"; diff --git a/home/profile/base.nix b/home/profile/base.nix index 6ac2d65..c9e48d2 100644 --- a/home/profile/base.nix +++ b/home/profile/base.nix @@ -84,8 +84,9 @@ in }; # this fixes a lot of theme weirdness - home.file.".icons".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/icons"; - home.file.".themes".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/themes"; + # this actually breaks home-manager's icon/theme management + # home.file.".icons".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/icons"; + # home.file.".themes".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/themes"; # some packages defined here may be redundant with packages on a non-NixOS # home-manager setup, but it's better to have a consistent environment at