28 May 2024 |
nbp | nixosModule.profile_option = {lib, ...}: {
key = "profile_option";
options.profile = lib.mkOption { ... };
};
| 12:50:38 |
Sam Lehman | If I collected all nixosModules from my inputs and set a key=<inputName>-<moduleName> attr, would this allow multiple imports of the same nixosModule ? | 12:51:11 |
Sam Lehman | Is key an attr of modules that gets handled by lib.evalModules ? Like I could specify a key attr inside a module definition, then import the same module in two places without error? | 12:52:12 |
nbp | I would say that an upstream issue, others would have the same problem as you, so you might as well fix it upstream. | 12:52:21 |
Sam Lehman | Is there any documentation on this behavior? | 12:52:23 |
nbp | key has been there since the beginning of the module system. | 12:53:21 |
Sam Lehman | What other attrs are used by lib.evalModules ? I've seen imports , disabledImports , config , and options , but I didn't know there were others. Is there a place I can read about this behavior or do I just need to do a deep dive on the source of lib.evalModules ? | 12:54:49 |
Sam Lehman | In reply to @nbp:mozilla.org I would say that an upstream issue, others would have the same problem as you, so you might as well fix it upstream. Definitely something I'd expect others to have problems with, so I'd be down to contribute to a fix.
How would I go about debugging lib.evalModules ?
| 12:57:06 |
nbp | When I said upstream, I meant the flake you use as input. | 15:52:59 |
3 Jun 2024 |
| @shalokshalom:kde.org left the room. | 16:23:46 |
4 Jun 2024 |
| infinisil changed their profile picture. | 02:43:30 |
12 Jun 2024 |
| Lorenz Leutgeb removed their display name Lorenz Leutgeb. | 00:31:19 |
| Lorenz Leutgeb set their display name to Lorenz Leutgeb. | 00:32:52 |
16 Jun 2024 |
| h7x4 joined the room. | 01:15:19 |
18 Jun 2024 |
Sam Lehman | Can you conditionally set imports if the condition isn't based on the config arg? | 20:54:51 |
19 Jun 2024 |
@djacu:matrix.org | Try it and report back 😛
But seriously what kind of conditional are you trying to use with imports? | 02:19:55 |
nbp | No, it is not possible to conditionally import files using imports list, as it is computed ahead of the configuration. | 09:40:48 |
nbp | However, you can conditionally configure using mkIf . | 09:41:29 |
nbp | What is your problem? | 09:43:16 |
20 Jun 2024 |
| @aadniz:knaben.org left the room. | 14:29:21 |
21 Jun 2024 |
mr-qubo | Redacted or Malformed Event | 13:19:32 |
3 Jul 2024 |
| k3ys joined the room. | 09:52:25 |
4 Jul 2024 |
| Philip Taron (UTC-8) left the room. | 15:46:22 |
| Philip Taron (UTC-8) joined the room. | 15:54:02 |
5 Jul 2024 |
zrsk | Is it possible to override an option? I don't mean an option's value, I mean overriding the option itself, like changing the type or the default (I can't use extendModules ) | 15:24:32 |
7 Jul 2024 |
| dminca joined the room. | 09:38:54 |
8 Jul 2024 |
nbp | zrsk: By default, no, you can extend some option types such as enum and submodules , but you cannot substitute the type by another one. However, you can disable the module (using disabledModules = [ <path-of-imported-module> ] ) and re-implement the same interface as the disabled module. | 10:48:59 |
nbp | disabledModules was introduced as a way to develop non-backward compatible changes without having the fork NixOS. | 10:49:44 |
zrsk | nbp: Yeah I know about disabledModules , it would be nice if there was a way to disable single options and then re-implement them. Anyway at the end I solved my problem (which was unrelated, my question here was due to a possible workaround I was considering). To be exact what I wanted to do was changing the default value for an option and I don't mean using mkDefault , I mean changing the value in options.foo.default without having direct access to where it was declared (I'm generating docs starting from imported modules but the default value for that option was a package that required an overlay I didn't want to apply, otherwise it gave an evaluation error) | 12:27:43 |
nbp | We do not have a way apart from disabledModules for replacing the default value for the documentation :/ | 12:35:53 |