Files
nixos-config/modules/home-manager/kubectl.nix

26 lines
704 B
Nix

{pkgs, ...}:
{
home.packages = [
pkgs.kubectl
];
# Add the shell alias
programs.fish.shellAliases = {
k = "kubectl";
};
# set the kubectl autocompletions for fish
# the fish functions are generated by kubectl itself, we do this at compile time and write them a single time to avoid generating them at each shell start
# the command is kubectl completion fish
# which becomes
programs.fish.completions."kubectl" = builtins.readFile "${pkgs.runCommand "kubectl-completion" {} ''
${pkgs.kubectl}/bin/kubectl completion fish > $out
''}";
programs.kubeswitch = {
enable = true;
enableFishIntegration = true;
};
}