My long-term vision for this flake is to use it as a control flake:
plug it into your homelab ("data-plane") flake and avail yourself
of its `lib.builders`, et cetera.
In short, I want this flake to be useful to many people, and that
means not shipping my homelab with it.
Everything I need directly from nix-kube-generators is now
handled in `lib/`. Additionally, now that I know buildYAMLStream always
takes a namespace and name, there's no need for the longer-winded name.
The reason I struggled with genericBuilders, and again when I replaced
`remoteYAML`'s NS-name `pname` with `url`, is that I was confusing the
following two things:
1. Things that fetch a resource (a Helm chart, a YAML stream, etc.)
without naming or namespacing it.
2. Things that create a release _by_ giving it a name and namespace
so that lib/output.sh can sort the resultant files into directories.
Additionally, I was questioning the good sense of releases/svc/gateway:
a release with no release, but only extra objects? Turns out I
needlessly bound the concept of JIT namespace injection to that
`extraObjects` feature. Once I abstracted that builder, the more general
solution became clear.
By declaring builders at the module level, only to call them in
flake.nix, I give myself the opportunity to inject `{name, namespace}`
there and need no longer pass these args into every module myself.
Even though I've refactored the values into Nix, I'd like them easily
available as YAML. This is impossible to do inside the flake, because
it requires `nix derivation show`, so I made do with a helper script.
I envision the derivation output to be a directory with nested namespace
directories with each release as a single YAML inside.
But I'm currently stuck at the `nix build` part.
charts/ and src/ both have two levels of children:
- charts/$repo/$chart
- src/$ns/$release
So, why not use one function to rake them both?
Also, the leaf-raking doesn't require nixpkgs or nix-kube-generators so
I moved everything that does (e.g.: `downloadCharts`) into the
`eachDefaultSystem` part of the output, following the example of
nixhelm's flake.
Why instantiate kubelib in `lib` when I have one in `flake.nix`?
Also, refactor `lib` so I understand it better. (It's straight copypasta
from `nixhelm`, and that bit me several times already.)