Replies: 1 comment 3 replies
-
|
In general I like the idea that wrapper-module maintainers have a way to specify nixos/hm modules which would get automatically injected to the users's nixos/hm config if they hook it up with Still some confusion about some of what you wrote:
So basically
You mean would be complex if
again, are you referring to the case where users would have to hook up the modules themselves?
What would be the alternative? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It is possible to return a module for another module system as an option of type
lib.types.deferredModuleorlib.types.rawIn my config, I did this for setting utempter for tmux on nixos installs here is how I imported it and here is where I defined it
It is also possible to make a module that will detect the current module system and apply the correct arguments like so:
You can also do this
We could use this to export a module that is detected by
mkInstallModuleand added to the imports of the module created by the option.Doing it manually may be somewhat complex for new users, but flake parts has a
modulesmodule that may serve as a generally useful example for an interface for such a thing, so that users don't have to think about it on that level of detail. And it could produce a generic module at a specified readOnly option for import elsewhereWe could include such an option in the core module, so that it is reliable to check for presence of this adapter module or not on the wrapper module.
It would help address some boilerplate in some scenarios like this one, where you may wish to set some extra options when using zsh as a default shell, for example.
https://github.com/BirdeeHub/birdeeSystems/blob/58498857c4f9dba474c641f1adca2e035e78f9f1/common/wrappers/zsh/module.nix#L10-L17
However, adding such instructions to the repo comes with some questions and concerns.
In that case, we are setting options that we do not control ourselves and thus may need maintenance. It is also another thing for contributors to have to think about when submitting a new module (maybe that is a good thing?).
It also raises another question. Many actually.
If we make these options, would we then need mkInstallModule still? Should mkInstallModule grab that value and use it directly if it exists, and otherwise do its standard thing? Or should they extend each other? How much boilerplate should be done for the author of the wrapper module in terms of the base options of passing it to environment.systemPackages themselves? Should they maybe use mkInstallModule in order to define each module? mkInstallModule is very generic in terms of the actual option names created by the function, should these options be similarly so? Should we allow them to toggle or customize the behavior but provide some by default?
I also would REALLY rather not become reliant on such an option, and still wish to create service options by generating them in the drv, and do as much in that kind of manner as absolutely possible. But then such an option could make a module that installs it to both
environment.systemPackagesANDsystemd.packages, for example.Many questions, but the idea seems interesting. If anyone has any feedback or ideas about the implementation of something like this, put it here, input is welcome!
Beta Was this translation helpful? Give feedback.
All reactions