k9s: add module

This commit is contained in:
Paul Meyer 2022-10-23 21:22:14 +02:00 committed by Robert Helgesson
parent 186d9399f9
commit 7dc4e4ebd7
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
11 changed files with 153 additions and 0 deletions

65
modules/programs/k9s.nix Normal file
View file

@ -0,0 +1,65 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.k9s;
yamlFormat = pkgs.formats.yaml { };
in {
meta.maintainers = [ hm.maintainers.katexochen ];
options.programs.k9s = {
enable =
mkEnableOption "k9s - Kubernetes CLI To Manage Your Clusters In Style";
package = mkPackageOption pkgs "k9s" { };
settings = mkOption {
type = yamlFormat.type;
default = { };
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/k9s/config.yml</filename>. See
<link xlink:href="https://k9scli.io/topics/config/"/>
for supported values.
'';
example = literalExpression ''
k9s = {
refreshRate = 2;
};
'';
};
skin = mkOption {
type = yamlFormat.type;
default = { };
description = ''
Skin written to
<filename>$XDG_CONFIG_HOME/k9s/skin.yml</filename>. See
<link xlink:href="https://k9scli.io/topics/skins/"/>
for supported values.
'';
example = literalExpression ''
k9s = {
body = {
fgColor = "dodgerblue";
};
};
'';
};
};
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;
};
};
}