diff --git a/modules/home-manager/k9s.nix b/modules/home-manager/k9s.nix index cdfdcde..a3fa6b2 100644 --- a/modules/home-manager/k9s.nix +++ b/modules/home-manager/k9s.nix @@ -1,13 +1,22 @@ -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (config.catppuccin) sources; cfg = config.programs.k9s.catppuccin; enable = cfg.enable && config.programs.k9s.enable; + # NOTE: On MacOS specifically, k9s expects its configuration to be in + # `~/Library/Application Support` when not using XDG + enableXdgConfig = !pkgs.stdenv.hostPlatform.isDarwin || config.xdg.enable; + themeName = "catppuccin-${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent"; themeFile = "${themeName}.yaml"; - themePath = "/skins/${themeFile}"; + themePath = "k9s/skins/${themeFile}"; theme = sources.k9s + "/dist/${themeFile}"; in { @@ -15,9 +24,11 @@ in transparent = lib.mkEnableOption "transparent version of flavor"; }; - config = lib.mkIf enable { - xdg.configFile."k9s${themePath}".source = theme; - - programs.k9s.settings.k9s.ui.skin = themeName; - }; + config = lib.mkIf enable (lib.mkMerge [ + (lib.mkIf (!enableXdgConfig) { + home.file."Library/Application Support/${themePath}".source = theme; + }) + (lib.mkIf enableXdgConfig { xdg.configFile.${themePath}.source = theme; }) + { programs.k9s.settings.k9s.ui.skin = themeName; } + ]); }