{ config, lib, pkgs, ... }: let inherit (config.rose-pine) sources; cfg = config.programs.k9s.rose-pine; 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; themeFile = "rose-pine.yaml"; themePath = "k9s/skins/${themeFile}"; theme = sources.k9s + "/skin.yml"; in { options.programs.k9s.rose-pine = lib.rp.mkRosePineOpt {name = "k9s";}; 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 = "rose-pine"; } ] ); }