-
|
I cannot wrap (no pun intended) my head around the implementation of the What is the reasons of using eval = lib.mkOption {
type = lib.types.functionTo lib.types.raw;
readOnly = true;
description = ''
Function to extend the current configuration with additional modules.
Re-evaluates the configuration with the original settings plus the new module.
Returns the raw evaluated module.
'';
default =
module:
evaled.extendModules {
modules = [
config._moduleSettings
module
{
_moduleSettings = lib.mkForce {
imports = [
config._moduleSettings
module
];
};
}
];
};
}; |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 18 replies
-
Yeah you would think that would be what it does, right? I mean, its named I would think that it would extend them. Problem is, if you don't store them like this, it doesn't seem to store any of the config values only the options? And so it warns that pkgs was accessed but not defined? I honestly am also somewhat confused. Ive been reading the source code of evalModules and it certainly LOOKS like it should not be necessary to do this? But it really seems to be? Edit: It might also be because each time, we call it from the same evaled variable. Rest assured, if I figure out how to remove that, I very much will Edit 2: It is because each time, we call it from the same evaled variable. I will come up with a better way to do this. Regardless, dont set or use the value yourself, it is labelled internal for a reason XD |
Beta Was this translation helpful? Give feedback.
-
|
It now should make more sense. We still need an internal option though, _moduleSettings was just not the correct one. It is now __extend and it holds the value of res.extendModules after each re-evaluation In order to achieve this, Because the module actually carries everything over now properly, I could not just mkForce the thing, because then I would mkForce multiple times and run into the same problem. So I had to make it a type in which the last assignment always is the winner. |
Beta Was this translation helpful? Give feedback.
-
|
Going to close this because it isnt going to be useful for anyone anymore given it now works in a more understandable way, so people don't need to be able to easily find this. |
Beta Was this translation helpful? Give feedback.
-
|
You might find this PR interesting #91 It added this https://birdeehub.github.io/nix-wrapper-modules/core.html#overrides It didnt touch how
Also this one #97 |
Beta Was this translation helpful? Give feedback.
-
|
2-3 weeks until neovim wrapper. Im a few days away from a working prototype, and Im going to mess around with it, refine it, fix up the descriptions for it and write a detailed description, write some tests and a template for it, and then its done. |
Beta Was this translation helpful? Give feedback.
-
|
You can call |
Beta Was this translation helpful? Give feedback.
It now should make more sense. We still need an internal option though, _moduleSettings was just not the correct one.
It is now __extend and it holds the value of res.extendModules after each re-evaluation
In order to achieve this, Because the module actually carries everything over now properly, I could not just mkForce the thing, because then I would mkForce multiple times and run into the same problem.
So I had to make it a type in which the last assignment always is the winner.