NixOS Module System | 167 Members | |
| 34 Servers |
| Sender | Message | Time |
|---|---|---|
| 30 May 2025 | ||
| I think I maybe misphrased my question, sorry, this was supposed to all be about getting args into the module... the tangent with the options was one way I'd tried to do this i.e. literally taking another when I tried setting my example is kinda convoluted at the moment - but I'll see if I can get something more minimal to send here... | 20:54:40 | |
| Without getting too much into the weeds, infinite recursion can show up for a number of reasons. Not just defining imports via a config value (such as non-special args). For example, trying to use an arg that doesn't exist usually shows up as infinite recursion too. E.g. if you were defining or using args in mismatched module evals. As for "merging in" special args; this isn't really possible because the whole point of special args is that they aren't defined by the module system. Is there a reason you need different args per user instead of using home-manager's shared | 21:02:00 | |
In reply to @mattsturg:matrix.org
Yeah, I've definitely seen this... the way I'm doing it at the moment is generating a list of modules for my NixOS config, including both modules that set home-manager user modules up and modules that set
gotcha - yeah... the special args are defined in NixOS and I have what I want them to be for the homes in NixOS. If I could merge in a different type for each attr of the attrsOf I think I could do it, since as I could merge in another submodule that has the specialArgs I want ... unfortunately it's pretty much all or nothing there
it's a pretty artificial constraint, but I'm not making the structure for homes themselves - so I can't guarentee that there aren't conflicting home args set in different homes ... I'm trying to make a thing that can be used to take standalone home-manager homes and put them in nixos systems - and the individual standalone home-manager home spec I have here doesn't share special args... what I'm trying to do is mostly plumbing, I hadn't considered seeing if I could get the home spec modified to better fit this case (or just, you know, ban setting these to different things) | 23:06:28 | |
| I'd strongly consider discouraging I appreciate E.g. this module uses
This one has access to
| 23:33:23 | |
| 31 May 2025 | ||
| Sorry if I was dismissive before, I'm fresh with coffee now! 😁
Well, in that example the
I would try a simple example; define two modules for the same user. One defining module args, the other trying to use them in some non-recursive way.
I was over-simplifying when I said this; because the submodule with the special args you're setting is a separate module eval, you are still defining them outside that module eval. However IDK if the submodule type supports type-merging them. e.g. if you declared a duplicate option with additional special args in its I.e. in some cases you can declare the same option twice, and the module system will merge those declarations (not definitions!). This is kinda black magic though, and only supports merging certain aspects of options. Most of the time you'll get an "option declared multiple times" error. If you really do need this and none of the alternative approaches I suggested are sufficient, I would suggest sending a PR to home-manager which adds a "per-user" The existing Such an option might look like:
Feel free to ping me in any relevant PRs. | 08:28:37 | |
| 13:10:36 | ||
| Hello! Given I am making a custom module system, and I have set _module.args.foobar = "something". I'm trying to use eval.extendModules and override the _module.args.foobar with a value with higher priority (by 1). In my case I cannot just hardcode another priority because the extendModules might be called multiple times, thus I need to override foobar multiple times. I tried finding the highestPrio field of _module.args.foobar using eval.options._module.args.foobar.highestPrio but it's saying that foobar doesn't exist here. Am I missing something? | 13:11:04 | |
| * Hello! Given I am making a custom module system, and I have set | 13:13:31 | |
| * Hello! Given I am making a custom module system, and I have set | 13:14:01 | |