From 7f899de0d3f5815b693c4b376b9e5277fb6d71a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Tue, 3 Mar 2026 23:16:30 -0300 Subject: [PATCH] home: install kubernetes tools --- scripts/default.nix | 5 +++++ scripts/kubectl-rsh | 30 ++++++++++++++++++++++++++++++ user/home.nix | 4 ++++ 3 files changed, 39 insertions(+) create mode 100755 scripts/kubectl-rsh diff --git a/scripts/default.nix b/scripts/default.nix index dca8862..3ebf1dd 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -48,6 +48,11 @@ _diffr ]; kak-man-pager = [ kak-pager ]; + kubectl-rsh = [ + bash + kubectl + rsync + ]; helix-pager = [ fish _diffr diff --git a/scripts/kubectl-rsh b/scripts/kubectl-rsh new file mode 100755 index 0000000..6a0e84f --- /dev/null +++ b/scripts/kubectl-rsh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -exu +set -o pipefail + +namespace='' +container='' +pod=$1 +shift + +# rsync calls us with "-l pod namespace" if we use pod@namespace +if [ "X$pod" = "X-l" ]; then + pod=$1 + shift + namespace="-n $1" + shift +fi + +# pod is "pod.container" +if [[ "$pod" == *"."* ]]; then + container="-c ${pod#*.}" + pod="${pod%.*}" +fi + +# pod is "type#name" +if [[ "$pod" == *"#"* ]]; then + pod="${pod//#/\/}" +fi + +exec kubectl $namespace exec -i $container $pod -- "$@" diff --git a/user/home.nix b/user/home.nix index 1a3d1c3..f6cc1e8 100644 --- a/user/home.nix +++ b/user/home.nix @@ -121,6 +121,10 @@ docker-compose mariadb + kubectl + kustomize + kubectl-rsh + nodePackages.intelephense nodePackages.typescript-language-server flow # js lsp server