fix(home-manager/k9s): support darwin without XDG (#311)
* fix(home-manager/k9s): k9s on darwin with xdg disabled k9s expects configuration files on OS X to live in `~/Library/Application Support/k9s` instead of `~/.config.k9s`. This commit handles the case where the module is built for a darwin system with xdg disabled. * Refactored - More closely matches the upstream module in home-manager - Formatted with nixfmt-rfc-style * Added missing parentheses Co-authored-by: seth <getchoo@tuta.io> --------- Co-authored-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
8886a68eda
commit
0047cf5816
1 changed files with 18 additions and 7 deletions
|
@ -1,13 +1,22 @@
|
||||||
{ config, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
inherit (config.catppuccin) sources;
|
inherit (config.catppuccin) sources;
|
||||||
|
|
||||||
cfg = config.programs.k9s.catppuccin;
|
cfg = config.programs.k9s.catppuccin;
|
||||||
enable = cfg.enable && config.programs.k9s.enable;
|
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";
|
themeName = "catppuccin-${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent";
|
||||||
themeFile = "${themeName}.yaml";
|
themeFile = "${themeName}.yaml";
|
||||||
themePath = "/skins/${themeFile}";
|
themePath = "k9s/skins/${themeFile}";
|
||||||
theme = sources.k9s + "/dist/${themeFile}";
|
theme = sources.k9s + "/dist/${themeFile}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -15,9 +24,11 @@ in
|
||||||
transparent = lib.mkEnableOption "transparent version of flavor";
|
transparent = lib.mkEnableOption "transparent version of flavor";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf enable {
|
config = lib.mkIf enable (lib.mkMerge [
|
||||||
xdg.configFile."k9s${themePath}".source = theme;
|
(lib.mkIf (!enableXdgConfig) {
|
||||||
|
home.file."Library/Application Support/${themePath}".source = theme;
|
||||||
programs.k9s.settings.k9s.ui.skin = themeName;
|
})
|
||||||
};
|
(lib.mkIf enableXdgConfig { xdg.configFile.${themePath}.source = theme; })
|
||||||
|
{ programs.k9s.settings.k9s.ui.skin = themeName; }
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue