kubecolor: add module

This commit is contained in:
Igor Rzegocki 2024-10-03 15:57:31 +02:00 committed by Robert Helgesson
parent e71e678d18
commit 8632735050
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
8 changed files with 197 additions and 0 deletions

View file

@ -0,0 +1,5 @@
{
kubecolor-empty-config = ./empty-config.nix;
kubecolor-example-config-default-paths = ./example-config-default-paths.nix;
kubecolor-example-config-xdg-paths = ./example-config-xdg-paths.nix;
}

View file

@ -0,0 +1,20 @@
{ pkgs, config, ... }:
let
configDir =
if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config";
in {
programs.kubecolor = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "kubecolor";
version = "0.4.0";
};
};
test.stubs.kubecolor = { };
nmt.script = ''
assertPathNotExists 'home-files/${configDir}/kube/color.yaml'
'';
}

View file

@ -0,0 +1,37 @@
{ pkgs, config, ... }:
let
configDir = if pkgs.stdenv.isDarwin then
"Library/Application Support/kube"
else
".kube";
in {
programs.kubecolor = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "kubecolor";
version = "0.4.0";
};
settings = {
kubectl = "kubectl";
preset = "dark";
objFreshThreshold = 0;
paging = "auto";
pager = "less";
};
};
nmt.script = ''
assertFileExists 'home-files/${configDir}/color.yaml'
assertFileContent 'home-files/${configDir}/color.yaml' \
${
builtins.toFile "expected.yaml" ''
kubectl: kubectl
objFreshThreshold: 0
pager: less
paging: auto
preset: dark
''
}
'';
}

View file

@ -0,0 +1,36 @@
{ config, ... }:
{
xdg.enable = true;
home.preferXdgDirectories = true;
programs.kubecolor = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "kubecolor";
version = "0.4.0";
};
settings = {
kubectl = "kubectl";
preset = "dark";
objFreshThreshold = 0;
paging = "auto";
pager = "less";
};
};
nmt.script = ''
assertFileExists 'home-files/.config/kube/color.yaml'
assertFileContent 'home-files/.config/kube/color.yaml' \
${
builtins.toFile "expected.yaml" ''
kubectl: kubectl
objFreshThreshold: 0
pager: less
paging: auto
preset: dark
''
}
'';
}