mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
add kubectl scripts
This commit is contained in:
parent
2759fbeaa6
commit
b1231fb0b8
2 changed files with 25 additions and 3 deletions
|
@ -1,6 +1,9 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
imports = [ ./powerline.nix ];
|
imports = [
|
||||||
|
./kubectl.nix
|
||||||
|
./powerline.nix
|
||||||
|
];
|
||||||
|
|
||||||
sconfig.powerline.enable = lib.mkDefault true;
|
sconfig.powerline.enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
@ -15,8 +18,6 @@
|
||||||
inetutils
|
inetutils
|
||||||
iotop
|
iotop
|
||||||
jq
|
jq
|
||||||
kubectl
|
|
||||||
kubernetes-helm
|
|
||||||
lm_sensors
|
lm_sensors
|
||||||
ncdu
|
ncdu
|
||||||
nix-index
|
nix-index
|
||||||
|
|
21
modules/cli/kubectl.nix
Normal file
21
modules/cli/kubectl.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ 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
|
||||||
|
'';
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.kubectl
|
||||||
|
pkgs.kubernetes-helm
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue