Files
nix/hosts/common/configs/user/console/kubernetes/default.nix
Nikolaos Karaolidis b631d466ff Add asusctl settings
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-05-25 21:18:28 +01:00

76 lines
1.7 KiB
Nix

{
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{
config,
lib,
pkgs,
...
}:
{
environment.persistence = {
"/persist"."${home}/.kube" = { };
"/cache"."${home}/.kube/cache" = { };
};
home-manager.users.${user} = {
home.packages = with pkgs; [
kubectl
kustomize
kubernetes-helm
kompose
kind
];
programs = {
k9s = {
enable = true;
settings.k9s = {
skipLatestRevCheck = true;
liveViewAutoRefresh = true;
refreshRate = 1;
ui = {
skin = "matugen";
logoless = true;
splashless = true;
reactive = true;
};
};
};
zsh = {
initContent = ''
kubeswitch() {
local target="$HOME/.kube/$1"
local config="$HOME/.kube/config"
if [[ -f "$target" && "$target" != "$config" ]]; then
ln -srf "$target" "$config"
echo "Switched kube context to $1"
p10k reload
else
echo "Invalid kube context: $1"
echo "Ensure the file exists in ~/.kube"
fi
}
_kubeswitch_completion() {
local dir="$HOME/.kube"
local config="$dir/config"
compadd -- ''${(f)"$(find "$dir" -maxdepth 1 \( -type f -o -type l \) -not -name 'config' -exec basename {} \;)"}
}
compdef _kubeswitch_completion kubeswitch
'';
p10k.extraRightPromptElements = [ "kubecontext" ];
};
};
theme.template.".config/k9s/skins/matugen.yaml".source = ./theme.yaml;
};
}