diff --git a/modules/kubenix.nix b/modules/kubenix.nix index 85f1fa4..21af843 100644 --- a/modules/kubenix.nix +++ b/modules/kubenix.nix @@ -9,7 +9,18 @@ with nix; { pkgs, system, ... - }: { + }: let + # TODO is there an even simpler way to do this? + kubenix-patched = pkgs.stdenv.mkDerivation rec { + inherit (src) name; + src = inputs.kubenix; + patches = [./kubenix.patch]; + buildPhase = '' + mkdir -p $out + cp -r $src/* $out + ''; + }; + in { config.canivete.devShell.apps.kubectl.script = "nix run \".#canivete.${system}.kubenix.clusters.$1.script\" -- \"\${@:2}\""; config.canivete.opentofu.workspaces = mapAttrs (_: getAttr "opentofu") config.canivete.kubenix.clusters; options.canivete.kubenix.clusters = mkOption { @@ -39,7 +50,7 @@ with nix; { type = package; description = "Kubernetes configuration file for cluster"; default = - (inputs.kubenix.evalModules.${system} { + (kubenix-patched.evalModules.${system} { specialArgs = {inherit nix;}; module = { kubenix, @@ -77,7 +88,7 @@ with nix; { # Generate resource definitions with IFD x 2 definitions = let - generated = import "${inputs.kubenix}/pkgs/generators/k8s" { + generated = import "${kubenix-patched}/pkgs/generators/k8s" { name = "kubenix-generated-for-crds"; inherit pkgs lib; # Mirror K8s OpenAPI spec diff --git a/modules/kubenix.patch b/modules/kubenix.patch new file mode 100644 index 0000000..4de4821 --- /dev/null +++ b/modules/kubenix.patch @@ -0,0 +1,5 @@ +--- a/modules/generated/v1.30.nix ++++ a/modules/generated/v1.30.nix +@@ -6305,1 +6305,1 @@ +- type = (types.nullOr (coerceAttrsOfSubmodulesToListByKey "io.k8s.api.core.v1.ContainerPort" "name" [ "containerPort" "protocol" ])); ++ type = (types.nullOr (coerceAttrsOfSubmodulesToListByKey "io.k8s.api.core.v1.ContainerPort" "name" [ "containerPort" ]));