k9s: v0.29/v0.30 compatibility
- Add `skins` option for definition of multiple skin files - Change file extension to ".yaml" - Deprecate `skin` option (points to `skins.skin`)
This commit is contained in:
parent
0021558dba
commit
020399c287
14 changed files with 212 additions and 59 deletions
|
|
@ -8,7 +8,20 @@ let
|
|||
yamlFormat = pkgs.formats.yaml { };
|
||||
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ katexochen liyangau ];
|
||||
meta.maintainers = with maintainers; [
|
||||
katexochen
|
||||
liyangau
|
||||
hm.maintainers.LucasWagler
|
||||
];
|
||||
|
||||
imports = [
|
||||
(mkRenamedOptionModule [ "programs" "k9s" "skin" ] [
|
||||
"programs"
|
||||
"k9s"
|
||||
"skins"
|
||||
"skin"
|
||||
])
|
||||
];
|
||||
|
||||
options.programs.k9s = {
|
||||
enable =
|
||||
|
|
@ -20,7 +33,7 @@ in {
|
|||
type = yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration written to {file}`$XDG_CONFIG_HOME/k9s/config.yml`. See
|
||||
Configuration written to {file}`$XDG_CONFIG_HOME/k9s/config.yaml`. See
|
||||
<https://k9scli.io/topics/config/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
|
|
@ -30,17 +43,19 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
skin = mkOption {
|
||||
type = yamlFormat.type;
|
||||
skins = mkOption {
|
||||
type = types.attrsOf yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Skin written to {file}`$XDG_CONFIG_HOME/k9s/skin.yml`. See
|
||||
Skin files written to {file}`$XDG_CONFIG_HOME/k9s/skins/`. See
|
||||
<https://k9scli.io/topics/skins/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
k9s = {
|
||||
body = {
|
||||
fgColor = "dodgerblue";
|
||||
my_blue_skin = {
|
||||
k9s = {
|
||||
body = {
|
||||
fgColor = "dodgerblue";
|
||||
};
|
||||
};
|
||||
};
|
||||
'';
|
||||
|
|
@ -50,7 +65,7 @@ in {
|
|||
type = yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Aliases written to {file}`$XDG_CONFIG_HOME/k9s/aliases.yml`. See
|
||||
Aliases written to {file}`$XDG_CONFIG_HOME/k9s/aliases.yaml`. See
|
||||
<https://k9scli.io/topics/aliases/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
|
|
@ -65,7 +80,7 @@ in {
|
|||
type = yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Hotkeys written to {file}`$XDG_CONFIG_HOME/k9s/hotkey.yml`. See
|
||||
Hotkeys written to {file}`$XDG_CONFIG_HOME/k9s/hotkey.yaml`. See
|
||||
<https://k9scli.io/topics/hotkeys/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
|
|
@ -86,7 +101,7 @@ in {
|
|||
type = yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Plugins written to {file}`$XDG_CONFIG_HOME/k9s/plugin.yml`. See
|
||||
Plugins written to {file}`$XDG_CONFIG_HOME/k9s/plugin.yaml`. See
|
||||
<https://k9scli.io/topics/plugins/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
|
|
@ -117,7 +132,7 @@ in {
|
|||
type = yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Resource column views written to {file}`$XDG_CONFIG_HOME/k9s/views.yml`.
|
||||
Resource column views written to {file}`$XDG_CONFIG_HOME/k9s/views.yaml`.
|
||||
See <https://k9scli.io/topics/columns/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
|
|
@ -140,31 +155,40 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = let
|
||||
skinSetting = if (!(cfg.settings ? k9s.ui.skin) && cfg.skins != { }) then {
|
||||
k9s.ui.skin = "${builtins.elemAt (builtins.attrNames cfg.skins) 0}";
|
||||
} else
|
||||
{ };
|
||||
|
||||
skinFiles = mapAttrs' (name: value:
|
||||
nameValuePair "k9s/skins/${name}.yaml" {
|
||||
source = yamlFormat.generate "k9s-skin-${name}.yaml" value;
|
||||
}) cfg.skins;
|
||||
in mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."k9s/config.yml" = mkIf (cfg.settings != { }) {
|
||||
source = yamlFormat.generate "k9s-config" cfg.settings;
|
||||
};
|
||||
xdg.configFile = {
|
||||
"k9s/config.yaml" = mkIf (cfg.settings != { }) {
|
||||
source = yamlFormat.generate "k9s-config"
|
||||
(lib.recursiveUpdate skinSetting cfg.settings);
|
||||
};
|
||||
|
||||
xdg.configFile."k9s/skin.yml" = mkIf (cfg.skin != { }) {
|
||||
source = yamlFormat.generate "k9s-skin" cfg.skin;
|
||||
};
|
||||
"k9s/aliases.yaml" = mkIf (cfg.aliases != { }) {
|
||||
source = yamlFormat.generate "k9s-aliases" cfg.aliases;
|
||||
};
|
||||
|
||||
xdg.configFile."k9s/aliases.yml" = mkIf (cfg.aliases != { }) {
|
||||
source = yamlFormat.generate "k9s-aliases" cfg.aliases;
|
||||
};
|
||||
"k9s/hotkey.yaml" = mkIf (cfg.hotkey != { }) {
|
||||
source = yamlFormat.generate "k9s-hotkey" cfg.hotkey;
|
||||
};
|
||||
|
||||
xdg.configFile."k9s/hotkey.yml" = mkIf (cfg.hotkey != { }) {
|
||||
source = yamlFormat.generate "k9s-hotkey" cfg.hotkey;
|
||||
};
|
||||
"k9s/plugin.yaml" = mkIf (cfg.plugin != { }) {
|
||||
source = yamlFormat.generate "k9s-plugin" cfg.plugin;
|
||||
};
|
||||
|
||||
xdg.configFile."k9s/plugin.yml" = mkIf (cfg.plugin != { }) {
|
||||
source = yamlFormat.generate "k9s-plugin" cfg.plugin;
|
||||
};
|
||||
|
||||
xdg.configFile."k9s/views.yml" = mkIf (cfg.views != { }) {
|
||||
source = yamlFormat.generate "k9s-views" cfg.views;
|
||||
};
|
||||
"k9s/views.yaml" = mkIf (cfg.views != { }) {
|
||||
source = yamlFormat.generate "k9s-views" cfg.views;
|
||||
};
|
||||
} // skinFiles;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue