nixos-config/modules/cli/kubernetes.nix

26 lines
662 B
Nix
Raw Normal View History

2023-04-30 06:11:27 +00:00
{ config, pkgs, lib, ... }:
{
programs.bash.interactiveShellInit = ''
kc(){
export KUBECONFIG=~/.kube/config."$1"
kubectl get nodes
}
_kc_completion(){
[ "''${#COMP_WORDS[@]}" != "2" ] ||
COMPREPLY=($(compgen -W "$(ls ~/.kube/ | grep '^config\.' | sed 's/^config\.//g')" -- "''${COMP_WORDS[1]}"))
}
complete -F _kc_completion kc
source <(kubectl completion bash)
complete -F __start_kubectl k
alias k=kubectl
'';
2023-05-22 06:52:56 +00:00
environment.systemPackages = with pkgs; [
kubectl
kubernetes-helm
(google-cloud-sdk.withExtraComponents
[ google-cloud-sdk.components.gke-gcloud-auth-plugin ])
2023-04-30 06:11:27 +00:00
];
}