-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introduce ezLib with funtions to import userModules #3
base: main
Are you sure you want to change the base?
Conversation
Previously adding a homeConfiguration to a host was only possible via setting `ezConfigs.darwin.hosts.<name>.userHomeModules` or `ezConfigs.nixos.hosts.<name>.userHomeModules` at the flake level. Importing a userModule inside a `nixosModule` or `darwinModule` was not possible. This commit introduces - `ezLib.nixosImportUserModule` - `ezLib.darwinImportUserModule` functions to allow this usage. `ezLib` is part of `specialArgs` and `extraSpecialArgs` and thus available in modules by default. Usage example for a `nixosModules/alice.nix` module: ```nix {ezLib, ...}: { imports = [ (ezLib.nixosImportUserModule "alice") ]; # User configuration, as given in nixos option example for users.users users.users.alice = { createHome = true; description = "Alice Q. User"; extraGroups = [ "wheel" ]; group = "users"; home = "/home/alice"; shell = "/bin/sh"; uid = 1234; }; } ``` Usage of `ezLib.darwinImportUserModule` is analogous.
Thanks a lot for another PR! Is { ezLib, ... }:
{
imports = [ (ezLib.nixosImportUserModule "alice") ];
{ Is it necessary to export If this is meant to replace |
yes exactly!
Probably not necessary, I was experimenting with also exporting the
I tried this approach, but did not get it to work (
For my usage: yes! I only want "generic" code in my
That's your call to make. If we agree on a way forward for this functionality I can add adeprecation warning for the old way to this PR. |
Hi, I like the idea! I'd like to migrate to ezConfigs with parts and one thing I'd like is user modules in the context of a host. I have these in my own configs like |
Previously adding a homeConfiguration to a host was only possible via setting
ezConfigs.darwin.hosts.<name>.userHomeModules
orezConfigs.nixos.hosts.<name>.userHomeModules
at the flake level. Importing a userModule inside anixosModule
ordarwinModule
was not possible.This commit introduces
ezLib.nixosImportUserModule
ezLib.darwinImportUserModule
functions to allow this usage.ezLib
is part ofspecialArgs
andextraSpecialArgs
and thus available in modules by default.I did not find a good place to document it yet. As it's not a flake-parts option there is no corresponding field for the documentation.
I use it similar to how it is outlined in the commit message.