Files
nix/hosts/common/configs/user/console/kubernetes/default.nix
Nikolaos Karaolidis 184aa4da8f Update
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-07-13 23:33:27 +01:00

73 lines
1.6 KiB
Nix

{ user, home }:
{
config,
lib,
pkgs,
...
}:
{
environment.persistence = {
"/persist/user"."${home}/.kube" = { };
"/persist/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;
};
}