Closed euank closed 4 years ago
After sleeping on it, I've realized what I'm doing wrong.
modules = [
./module.nix { inherit kubenix; }
];
should have been
modules = [
./module.nix { }
];
I think evalModules
is already plumbing in a correctly setup kubenix, and inherit was overriding that with one from the outer scope.
Now that I check the example in this repo, I also see that it's doing the right thing, so I'm not sure why I had that there.
Sorry for the noise, I'll close this since I figured it out
No problem, sorry for late response, have not been working on kubenix for some time.
The issue I'm seeing seems only happens when using a module in a separate file, so it might be me misunderstanding modules. Or maybe it's a bug in kubenix because I'm not doing anything unusual I think.
Here's a repro for the error I'm seeing:
If I try to build that kubernetes object, I get:
I think it's related to modules because if I shove it all in one file, like so, then it builds correctly:
One other thing to note: after poking through the stacktrace, I realized the inscrutable error may have actually been trying to say "kubenix.project wasn't set".
If I delete the two lines in
modules/k8s.nix
that referenceconfig.kubenix.project
(https://github.com/xtruder/kubenix/blob/611059a329493a77ec0e862fcce4671cd3768f32/modules/k8s.nix#L361 and line 388), my repro no longer errors out and produces something that works for me.My totally uneducated understanding is that
kubenix.evalModules
is breaking the default forproject = "kubenix"
somehow, and when I don't split the module into a separate file, I don't see this issue because I guess I'm using the kubenix from the outer scope anyway? Yeah, I'm not totally sure.