Skip to content

Makes kubectl plug-ins from the Krew repository accessible to Nix

License

Notifications You must be signed in to change notification settings

a1994sc/krew2nix

This branch is 300 commits ahead of, 5 commits behind eigengrau/krew2nix:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8b01da8 · Mar 2, 2025
Jul 4, 2024
May 25, 2024
Mar 2, 2025
May 22, 2024
May 22, 2024
May 22, 2024
May 22, 2024
Jul 4, 2024
May 25, 2024
May 22, 2024
May 22, 2024
May 23, 2024
May 22, 2024
May 22, 2024

Repository files navigation

krew2nix

Gather new plugins Update plugins

TL/DR:

The examples use flakes as the primary way to get the krew support into nix.

NixOS

  nixpkgs.overlays = [ inputs.krew2nix.overlay ];
  environment.systemPackages = [ kubectl.withKrewPlugins (plugins: [ plugins.node-shell ]) ];

Home-manager

  nixpkgs.overlays = [ inputs.krew2nix.overlay ];
  home.packages = [ kubectl.withKrewPlugins (plugins: [ plugins.node-shell ]) ];

Examples

devShell

{
  inputs = {
    # keep-sorted start block=yes case=no
    krew2nix = {
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.systems.follows = "systems";
      url = "github:a1994sc/krew2nix";
    };
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
    systems.url = "github:nix-systems/default";
    # keep-sorted end
  };
  outputs = { nixpkgs, flake-utils, krew2nix, ... }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {
        overlays = [ self.overlay ];
        inherit system;
      };
    in {
      devShell = pkgs.mkShell {
        nativeBuildInputs = [ pkgs.bashInteractive ];
        buildInputs = with pkgs;[
          k9s
          (wrapHelm kubernetes-helm {
            plugins = with pkgs; [ 
              kubernetes-helmPlugins.helm-secrets
              kubernetes-helmPlugins.helm-unittest
            ];
          })
          (kubectl.withKrewPlugins (plugins: with plugins; [
            df-pv
            krew
            node-shell
          ]))
        ];
      };
    });
}

Enter with nix develop.

About

Makes kubectl plug-ins from the Krew repository accessible to Nix

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Nix 60.5%
  • Ruby 28.9%
  • Shell 10.6%