mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01:00
k9s: add module
This commit is contained in:
parent
186d9399f9
commit
7dc4e4ebd7
11 changed files with 153 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -155,6 +155,9 @@ Makefile @thiagokokada
|
|||
|
||||
/modules/programs/just.nix @maximsmol
|
||||
|
||||
/modules/programs/k9s.nix @katexochen
|
||||
/tests/modules/programs/k9s @katexochen
|
||||
|
||||
/modules/programs/keychain.nix @marsam
|
||||
|
||||
/modules/programs/kodi.nix @dwagenk
|
||||
|
|
|
@ -101,6 +101,12 @@
|
|||
fingerprint = "2BE3 BAFD 793E A349 ED1F F00F 04D0 CEAF 916A 9A40";
|
||||
}];
|
||||
};
|
||||
katexochen = {
|
||||
name = "Paul Meyer";
|
||||
email = "49727155+katexochen@users.noreply.github.com";
|
||||
github = "katexochen";
|
||||
githubId = 49727155;
|
||||
};
|
||||
kubukoz = {
|
||||
name = "Jakub Kozłowski";
|
||||
email = "kubukoz@users.noreply.github.com";
|
||||
|
|
|
@ -793,6 +793,13 @@ in
|
|||
enabling this.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2022-10-24T22:05:27+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.k9s'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ let
|
|||
./programs/java.nix
|
||||
./programs/jq.nix
|
||||
./programs/just.nix
|
||||
./programs/k9s.nix
|
||||
./programs/kakoune.nix
|
||||
./programs/keychain.nix
|
||||
./programs/kitty.nix
|
||||
|
|
65
modules/programs/k9s.nix
Normal file
65
modules/programs/k9s.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -80,6 +80,7 @@ import nmt {
|
|||
./modules/programs/hyfetch
|
||||
./modules/programs/i3status
|
||||
./modules/programs/irssi
|
||||
./modules/programs/k9s
|
||||
./modules/programs/kakoune
|
||||
./modules/programs/kitty
|
||||
./modules/programs/less
|
||||
|
|
4
tests/modules/programs/k9s/default.nix
Normal file
4
tests/modules/programs/k9s/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
k9s-example-settings = ./example-settings.nix;
|
||||
k9s-empty-settings = ./empty-settings.nix;
|
||||
}
|
11
tests/modules/programs/k9s/empty-settings.nix
Normal file
11
tests/modules/programs/k9s/empty-settings.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.k9s.enable = true;
|
||||
|
||||
test.stubs.k9s = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/k9s
|
||||
'';
|
||||
}
|
5
tests/modules/programs/k9s/example-config-expected.yml
Normal file
5
tests/modules/programs/k9s/example-config-expected.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
k9s:
|
||||
enableMouse: true
|
||||
headless: false
|
||||
maxConnRetry: 5
|
||||
refreshRate: 2
|
42
tests/modules/programs/k9s/example-settings.nix
Normal file
42
tests/modules/programs/k9s/example-settings.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.k9s = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings = {
|
||||
k9s = {
|
||||
refreshRate = 2;
|
||||
maxConnRetry = 5;
|
||||
enableMouse = true;
|
||||
headless = false;
|
||||
};
|
||||
};
|
||||
|
||||
skin = {
|
||||
k9s = {
|
||||
body = {
|
||||
fgColor = "dodgerblue";
|
||||
bgColor = "#ffffff";
|
||||
logoColor = "#0000ff";
|
||||
};
|
||||
info = {
|
||||
fgColor = "lightskyblue";
|
||||
sectionColor = "steelblue";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/k9s/config.yml
|
||||
assertFileContent \
|
||||
home-files/.config/k9s/config.yml \
|
||||
${./example-config-expected.yml}
|
||||
assertFileExists home-files/.config/k9s/skin.yml
|
||||
assertFileContent \
|
||||
home-files/.config/k9s/skin.yml \
|
||||
${./example-skin-expected.yml}
|
||||
'';
|
||||
}
|
8
tests/modules/programs/k9s/example-skin-expected.yml
Normal file
8
tests/modules/programs/k9s/example-skin-expected.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
k9s:
|
||||
body:
|
||||
bgColor: '#ffffff'
|
||||
fgColor: dodgerblue
|
||||
logoColor: '#0000ff'
|
||||
info:
|
||||
fgColor: lightskyblue
|
||||
sectionColor: steelblue
|
Loading…
Reference in a new issue