2022-10-23 21:22:14 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.k9s;
|
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
|
|
|
|
in {
|
2023-11-01 18:40:14 +01:00
|
|
|
meta.maintainers = with maintainers; [ katexochen liyangau ];
|
2022-10-23 21:22:14 +02:00
|
|
|
|
|
|
|
options.programs.k9s = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable =
|
|
|
|
mkEnableOption "k9s - Kubernetes CLI To Manage Your Clusters In Style";
|
2022-10-23 21:22:14 +02:00
|
|
|
|
2023-07-02 01:45:18 +02:00
|
|
|
package = mkPackageOption pkgs "k9s" { };
|
2022-10-23 21:22:14 +02:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-10-23 21:22:14 +02:00
|
|
|
Configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/k9s/config.yml`. See
|
|
|
|
<https://k9scli.io/topics/config/>
|
2022-10-23 21:22:14 +02:00
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
example = literalExpression ''
|
|
|
|
k9s = {
|
|
|
|
refreshRate = 2;
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
skin = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-10-23 21:22:14 +02:00
|
|
|
Skin written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/k9s/skin.yml`. See
|
|
|
|
<https://k9scli.io/topics/skins/>
|
2022-10-23 21:22:14 +02:00
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
example = literalExpression ''
|
|
|
|
k9s = {
|
|
|
|
body = {
|
|
|
|
fgColor = "dodgerblue";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
};
|
2023-11-01 18:40:14 +01:00
|
|
|
|
|
|
|
hotkey = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
|
|
|
description = ''
|
|
|
|
hotkeys written to
|
|
|
|
{file}`$XDG_CONFIG_HOME/k9s/hotkey.yml`. See
|
|
|
|
<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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
};
|
2022-10-23 21:22:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = 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/skin.yml" = mkIf (cfg.skin != { }) {
|
|
|
|
source = yamlFormat.generate "k9s-skin" cfg.skin;
|
|
|
|
};
|
2023-11-01 18:40:14 +01:00
|
|
|
|
|
|
|
xdg.configFile."k9s/hotkey.yml" = mkIf (cfg.hotkey != { }) {
|
|
|
|
source = yamlFormat.generate "k9s-hotkey" cfg.hotkey;
|
|
|
|
};
|
2022-10-23 21:22:14 +02:00
|
|
|
};
|
|
|
|
}
|