NixOS Module System | 148 Members | |
| 29 Servers |
| Sender | Message | Time |
|---|---|---|
| 1 Feb 2024 | ||
In reply to @infinisil:matrix.orgI tried that! You can see it is the last thing under the # NONE OF THESE WORK; conflicting definitions section. line 56 | 20:34:06 | |
| Oh um.... | 20:34:36 | |
Ahh! The problem is that config.user doesn't contain any mkForce anymore. It's an evaluated option, so all of those modifiers are gone | 20:39:01 | |
So the input to user is lib.mkForce { b = 3; }, but it outputs just { b = 3; }, no conflict there, since there's just one definition | 20:39:48 | |
Similarly the input to defaults is just that one default = { a = 1; b = 2; } (which is actually defaults = lib.mkOptionDefault { ... } but that's not relevant here), it outputs { a = 1; b = 2; } | 20:40:38 | |
| Finally, you have effectively
| 20:41:10 | |
| * Finally, you have effectively
Both of which are without priority, so it recurses into the attrs and conflicts because two | 20:41:59 | |
Instead if you want to actually copy the definitions from one option to another, the mkAlias function suite is what you need: https://github.com/NixOS/nixpkgs/blob/master/lib/modules.nix#L1039-L1073 | 20:43:19 | |
* Instead if you want to actually copy the definitions from one option to another, the mkAlias function suite is what you need: https://github.com/NixOS/nixpkgs/blob/a0d3f10c751b6b2642b44d327470f68ad6bc7952/lib/modules.nix#L1039-L1073 | 20:43:32 | |
| 2 Feb 2024 | ||
| Ah that's a pretty sweet suite. Just so I understanding you completely, you're just mentioning this for other use cases. Not suggesting that it could be used in the example I provided? | 00:45:43 | |
That alias stuff is pretty messy, I wouldn't recommend that myself, but sometimes it is needed. In this case the simpler mapAttrs (name: mkDefault) works though | 02:53:43 | |
| 05:25:20 | ||
| 20:01:14 | ||
| 5 Feb 2024 | ||
| 01:34:42 | ||
| 8 Feb 2024 | ||
| 10:38:02 | ||
| 15 Feb 2024 | ||
| 19:15:14 | ||
| 16 Feb 2024 | ||
| 14:56:15 | ||
| 14:59:24 | ||
| I recently stumbled upon similar issue when working on home-manager. https://discourse.nixos.org/t/is-it-possible-to-define-systemd-services-in-a-submodule/39538/5 The idea is that enabling https://nix-community.github.io/home-manager/options.xhtml#opt-programs.bash.enableCompletion should set I think that module system is missing an option to pass config options recursively up to all ancestors. | 15:06:01 | |
My idea is that nixos config could have a property extraNixosChildConfig and in home-manager bash module I could set _recurseAncestors = { extraNixosChildConfig = { environment.pathsToLink = [ ... ]; }; }. | 15:07:22 | |
| wdyt? | 15:07:26 | |
* My idea is that nixos config could have a property extraNixosChildConfig that gets merged with the rest of the config and in home-manager bash module I could set _recurseAncestors = { extraNixosChildConfig = { environment.pathsToLink = [ ... ]; }; }. | 15:07:44 | |
* My idea is that nixos config could pick up extraNixosChildConfig from childs and merge it with the rest of the config and in home-manager bash module I could set _recurseAncestors = { extraNixosChildConfig = { environment.pathsToLink = [ ... ]; }; }. | 15:08:21 | |
| Not sure about that recursive thing, that doesn't seem necessary, but yeah if there's something missing in the NixOS module for home-manager, that could be added | 15:34:09 | |
| Sounds like an issue for the home-manager repo | 15:34:16 | |
| Yeah, we could add it just for home-manager. But is seems like the issue is quite generic. See also https://github.com/NixOS/nixpkgs/pull/152785. | 15:51:50 | |
| Hmm yeah fair. I don't have the capacity to think a lot about this right now, it's a very intricate topic to wrap ones head around | 15:56:55 | |
| Yeah, I just wanted to bring the topic, maybe someone has some interesting thoughts. | 16:05:23 | |
| 17:49:31 | ||
| 20 Feb 2024 | ||
| I'm reading through the module system deep dive on nix.dev and am wondering if there is a behavioral difference between setting an options default behavior in the this
vs this
| 21:39:27 | |