From 23f8df7396d35744069a4bda0d1d38a55ff64b79 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 21 Jul 2025 07:31:45 -0700 Subject: refactoring to use flake-parts and automatic imports of hosts This is the first step in a large refactoring to use flake-parts, and to automatically imports hosts based on paths. --- nix/users/profiles/k8s.nix | 91 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 nix/users/profiles/k8s.nix (limited to 'nix/users/profiles/k8s.nix') diff --git a/nix/users/profiles/k8s.nix b/nix/users/profiles/k8s.nix new file mode 100644 index 0000000..ec59228 --- /dev/null +++ b/nix/users/profiles/k8s.nix @@ -0,0 +1,91 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + kind # k8s in docker + kubebuilder # generate controller + kubectl + kubernetes-helm # deploy applications + kubie # kubeconfig browser https://github.com/sbstp/kubie + kubelogin-oidc # OIDC plugin + ]; + + programs.k9s = { + enable = true; + settings = { + k9s = { + refreshRate = 1; + }; + }; + plugin = { + plugins = { + log-bat = { + shortCut = "Shift-L"; + description = "Logs (bat)"; + scopes = [ "po" ]; + command = "bash"; + background = false; + args = [ + "-c" + "\"$@\" | bat" + "dummy-arg" + "kubectl" + "logs" + "$NAME" + "-n" + "$NAMESPACE" + "--context" + "$CONTEXT" + "--kubeconfig" + "$KUBECONFIG" + ]; + }; + log-bat-container = { + shortCut = "Shift-L"; + description = "Logs (bat)"; + scopes = [ "containers" ]; + command = "bash"; + background = false; + args = [ + "-c" + "\"$@\" | bat" + "dummy-arg" + "kubectl" + "logs" + "-c" + "$NAME" + "$POD" + "-n" + "$NAMESPACE" + "--context" + "$CONTEXT" + "--kubeconfig" + "$KUBECONFIG" + ]; + }; + }; + }; + }; + + home.file.kubie = { + target = ".kube/kubie.yaml"; + text = '' + shell: fish + configs: + include: + - ~/.kube/rksconfig + prompt: + fish_use_rprompt: false + ''; + }; + + programs.fish = { + shellAbbrs = { + k = "kubectl"; + kctx = "kubie ctx"; + klogs = "kubectl logs"; + }; + shellAliases = { + ukctx = "${pkgs.gh}/bin/gh api --hostname github.rbx.com repos/Roblox/cell-lifecycle/contents/rks/kubeconfig --jq '.content' | base64 -d > ~/.kube/rksconfig"; + }; + }; +} -- cgit v1.2.3