kubecolor: clean up the handling of config path

This commit is contained in:
Hoang Nguyen 2026-01-12 21:55:26 +07:00 committed by Austin Horstman
parent 94597e670f
commit 1dc235b2fb
4 changed files with 15 additions and 29 deletions

View file

@ -1,8 +1,5 @@
{ pkgs, config, ... }:
{ config, ... }:
let
configDir = if pkgs.stdenv.isDarwin then "Library/Application Support" else ".config";
in
{
programs.kubecolor = {
enable = true;
@ -13,6 +10,7 @@ in
};
nmt.script = ''
assertPathNotExists 'home-files/${configDir}/kube/color.yaml'
assertPathNotExists 'home-files/.kube/color.yaml'
assertPathNotExists 'home-files/.config/kubecolor.yaml'
'';
}

View file

@ -1,8 +1,5 @@
{ pkgs, config, ... }:
{ config, ... }:
let
configDir = if pkgs.stdenv.isDarwin then "Library/Application Support/kube" else ".kube";
in
{
programs.kubecolor = {
enable = true;
@ -20,8 +17,8 @@ in
};
nmt.script = ''
assertFileExists 'home-files/${configDir}/color.yaml'
assertFileContent 'home-files/${configDir}/color.yaml' \
assertFileExists 'home-files/.kube/color.yaml'
assertFileContent 'home-files/.kube/color.yaml' \
${builtins.toFile "expected.yaml" ''
kubectl: kubectl
objFreshThreshold: 0

View file

@ -20,8 +20,8 @@
};
nmt.script = ''
assertFileExists 'home-files/.config/kube/color.yaml'
assertFileContent 'home-files/.config/kube/color.yaml' \
assertFileExists 'home-files/.config/kubecolor.yaml'
assertFileContent 'home-files/.config/kubecolor.yaml' \
${builtins.toFile "expected.yaml" ''
kubectl: kubectl
objFreshThreshold: 0