NixOS Module System | 154 Members | |
| 33 Servers |
| Sender | Message | Time |
|---|---|---|
| 16 May 2025 | ||
On line 11 you assign freeformType to a submodule, but freeformType must be an attrsOf type. | 22:12:06 | |
| On line 45 you're defining If you're evaluating these directly with
| 22:14:08 | |
Yeah I was wondering if I misunderstood the "freeformType is an option" | 22:15:13 | |
| Whoops, the snippet is screwed then I guess | 22:15:50 | |
| Here's what I meant by freeformType is an option: https://github.com/NixOS/nixpkgs/blob/ec56f7ae8cdc39eebb8a3b4aa7a3a6365c214fb5/lib/modules.nix#L213-L227 You can set it explicitly in a submodule by defining e.g. | 22:17:34 | |
Was my second guess. Thanks for walking me through these! | 22:19:58 | |
Does work with mkOption indeed: https://gist.github.com/SomeoneSerge/b278317b83e5090fbfa9472c78701703 | 22:51:20 | |
| Awesome! I'd highly recommend checking the The | 22:56:09 | |
Yes, an error. Still struggling a bit conceptually though, seems like there are three different kinds of entities in evalModules: "types" are things that have checks, "modules" are things that produce options and configs, but options are confusing | 23:17:40 | |
It's not possible to extend options._module.freeformType with an apply from outside? | 23:18:12 | |
* It's not possible to extend options._module.freeformType with an apply from outside is it? | 23:18:15 | |
* Yes, an error. Still struggling a bit conceptually though, seems like there are three different kinds of entities in evalModules: "types" are things that have checks, "modules" are things that produce options and configs, but "options" are confusing | 23:18:43 | |
| Yes, there's a few "types" of thing in the module system:
Submodules are an | 23:24:13 | |
| I'm not sure. Usually merging things relates to having multiple definitions for an option, but the module system does also support merging multiple declarations for an option too, in some scenarios. You may be able to declare | 23:26:47 | |
Ah right, I was trying ...freeformType.apply = instead, but I actually knew this bit.But I realized I don't actually need apply in freeformType: I was trying to reproduce the same trick at the top-level instead of at foo. | 23:35:26 | |
| 17 May 2025 | ||
| 20:12:20 | ||
| 20 May 2025 | ||
| 21:44:52 | ||
| 21 May 2025 | ||
| 17:42:04 | ||
I see that nixos/lib and nixos/modules use normal path values in _file (except for modulesPath = toString ./eval-config.nix), but somehow in man configuration.nix we get relative paths without hashes? How does that happen | 17:48:12 | |
| path values only get copied to the store when used with string interpolation (e.g. E.g.
| 17:53:58 | |
Ohhh so nixos/modules actually does pass strings around and not paths? | 18:00:37 | |
| 18:02:08 | |
| This is 100% a "path" | 18:02:19 | |
| 18:03:29 | |
So there is some magic happening that makes this ./eval-config.nix into a string that is relative to.... hmmm parent of the checkout | 18:03:57 | |
IIRC specialArgs.modulesPath is removed if it is a prefix of the stringified _file. | 18:05:42 | |
No, but when rendering files in errors, docs, etc they are stringified using | 18:06:40 | |
| 18:21:49 | ||
| 23 May 2025 | ||
Btw that magic was in pkgs/ in nixosOptionsDoc | 22:32:42 | |
Next one! Given (evalModules {...}).options and a path in options, is there a ready tool to tell which definition (with location) won the priority? I see I can access definitionsWithLocations which is an unfiltered list, and, to further complicate things, in case of an attrsOf option there's just the top-level list, which doesn't directly relate paths under the option to definitions or locations. | 22:36:26 | |