k9s: fix config files not generated correctly & improve options (#7262)
This commit is contained in:
parent
6fa01d524b
commit
520fc4b50a
7 changed files with 144 additions and 101 deletions
|
|
@ -33,6 +33,8 @@ in
|
|||
"skin"
|
||||
]
|
||||
)
|
||||
(lib.mkRenamedOptionModule [ "programs" "k9s" "hotkey" ] [ "programs" "k9s" "hotKeys" ])
|
||||
(lib.mkRenamedOptionModule [ "programs" "k9s" "plugin" ] [ "programs" "k9s" "plugins" ])
|
||||
];
|
||||
|
||||
options.programs.k9s = {
|
||||
|
|
@ -86,14 +88,14 @@ in
|
|||
<https://k9scli.io/topics/aliases/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
alias = {
|
||||
{
|
||||
# Use pp as an alias for Pod
|
||||
pp = "v1/pods";
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
hotkey = mkOption {
|
||||
hotKeys = mkOption {
|
||||
type = yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
|
|
@ -102,20 +104,17 @@ in
|
|||
<https://k9scli.io/topics/hotkeys/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
hotkey = {
|
||||
# Make sure this is camel case
|
||||
hotKey = {
|
||||
shift-0 = {
|
||||
shortCut = "Shift-0";
|
||||
description = "Viewing pods";
|
||||
command = "pods";
|
||||
};
|
||||
{
|
||||
shift-0 = {
|
||||
shortCut = "Shift-0";
|
||||
description = "Viewing pods";
|
||||
command = "pods";
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
plugin = mkOption {
|
||||
plugins = mkOption {
|
||||
type = yamlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
|
|
@ -124,7 +123,7 @@ in
|
|||
<https://k9scli.io/topics/plugins/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
plugin = {
|
||||
{
|
||||
# Defines a plugin to provide a `ctrl-l` shortcut to
|
||||
# tail the logs while in pod view.
|
||||
fred = {
|
||||
|
|
@ -143,7 +142,7 @@ in
|
|||
"$CLUSTER"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -157,21 +156,19 @@ in
|
|||
See <https://k9scli.io/topics/columns/> for supported values.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
k9s = {
|
||||
views = {
|
||||
"v1/pods" = {
|
||||
columns = [
|
||||
"AGE"
|
||||
"NAMESPACE"
|
||||
"NAME"
|
||||
"IP"
|
||||
"NODE"
|
||||
"STATUS"
|
||||
"READY"
|
||||
];
|
||||
};
|
||||
{
|
||||
"v1/pods" = {
|
||||
columns = [
|
||||
"AGE"
|
||||
"NAMESPACE"
|
||||
"NAME"
|
||||
"IP"
|
||||
"NODE"
|
||||
"STATUS"
|
||||
"READY"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
@ -206,6 +203,16 @@ in
|
|||
in
|
||||
mkIf cfg.enable {
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
warnings =
|
||||
(lib.optional (cfg.aliases ? alias)
|
||||
"Nested 'alias' key in programs.k9s.aliases is deprecated, move the contents directly under programs.k9s.aliases"
|
||||
)
|
||||
++ (lib.optional (cfg.plugins ? plugin)
|
||||
"Nested 'plugin' key in programs.k9s.plugins is deprecated, move the contents directly under programs.k9s.plugins"
|
||||
)
|
||||
++ (lib.optional (cfg.views ? k9s.views)
|
||||
"Nested 'k9s.views' structure in programs.k9s.views is deprecated, move the contents directly under programs.k9s.views"
|
||||
);
|
||||
|
||||
xdg.configFile = mkIf enableXdgConfig (
|
||||
{
|
||||
|
|
@ -214,19 +221,19 @@ in
|
|||
};
|
||||
|
||||
"k9s/aliases.yaml" = mkIf (cfg.aliases != { }) {
|
||||
source = yamlFormat.generate "k9s-aliases" cfg.aliases;
|
||||
source = yamlFormat.generate "k9s-aliases" { inherit (cfg) aliases; };
|
||||
};
|
||||
|
||||
"k9s/hotkeys.yaml" = mkIf (cfg.hotkey != { }) {
|
||||
source = yamlFormat.generate "k9s-hotkey" cfg.hotkey;
|
||||
"k9s/hotkeys.yaml" = mkIf (cfg.hotKeys != { }) {
|
||||
source = yamlFormat.generate "k9s-hotkeys" { inherit (cfg) hotKeys; };
|
||||
};
|
||||
|
||||
"k9s/plugins.yaml" = mkIf (cfg.plugin != { }) {
|
||||
source = yamlFormat.generate "k9s-plugin" cfg.plugin;
|
||||
"k9s/plugins.yaml" = mkIf (cfg.plugins != { }) {
|
||||
source = yamlFormat.generate "k9s-plugins" { inherit (cfg) plugins; };
|
||||
};
|
||||
|
||||
"k9s/views.yaml" = mkIf (cfg.views != { }) {
|
||||
source = yamlFormat.generate "k9s-views" cfg.views;
|
||||
source = yamlFormat.generate "k9s-views" { inherit (cfg) views; };
|
||||
};
|
||||
}
|
||||
// skinFiles
|
||||
|
|
@ -239,19 +246,19 @@ in
|
|||
};
|
||||
|
||||
"Library/Application Support/k9s/aliases.yaml" = mkIf (cfg.aliases != { }) {
|
||||
source = yamlFormat.generate "k9s-aliases" cfg.aliases;
|
||||
source = yamlFormat.generate "k9s-aliases" { inherit (cfg) aliases; };
|
||||
};
|
||||
|
||||
"Library/Application Support/k9s/hotkeys.yaml" = mkIf (cfg.hotkey != { }) {
|
||||
source = yamlFormat.generate "k9s-hotkey" cfg.hotkey;
|
||||
"Library/Application Support/k9s/hotkeys.yaml" = mkIf (cfg.hotKeys != { }) {
|
||||
source = yamlFormat.generate "k9s-hotkeys" { inherit (cfg) hotKeys; };
|
||||
};
|
||||
|
||||
"Library/Application Support/k9s/plugins.yaml" = mkIf (cfg.plugin != { }) {
|
||||
source = yamlFormat.generate "k9s-plugin" cfg.plugin;
|
||||
"Library/Application Support/k9s/plugins.yaml" = mkIf (cfg.plugins != { }) {
|
||||
source = yamlFormat.generate "k9s-plugins" { inherit (cfg) plugins; };
|
||||
};
|
||||
|
||||
"Library/Application Support/k9s/views.yaml" = mkIf (cfg.views != { }) {
|
||||
source = yamlFormat.generate "k9s-views" cfg.views;
|
||||
source = yamlFormat.generate "k9s-views" { inherit (cfg) views; };
|
||||
};
|
||||
}
|
||||
// skinFiles
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue