{ user ? throw "user argument is required", home ? throw "home argument is required", }: { pkgs, ... }: { home-manager.users.${user} = { home.packages = with pkgs; [ kubectl kubernetes-helm kind ]; programs.zsh = { initExtra = '' kubeswitch() { local target="$HOME/.kube/$1" local config="$HOME/.kube/config" if [[ -f "$target" && "$target" != "$config" ]]; then ln -sf "$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" ]; }; }; }