-
Notifications
You must be signed in to change notification settings - Fork 24
Description
One of the reasons to not use Home-Manager is the massive amount of time it takes to be evaluated. This is primarily because (just like NixOS) it imports every single module by default. Currently, Hjem-Rum has far less modules than Home-Manager, which means it provides a great benefit over Home-Manager - faster rebuilds. However, this won't last, as Hjem-Rum continues to gain more modules.
I motion that we take this opportunity to go all-in on optional modules. Rather than having a single module that then imports everything (as we currently do in the flake.nix), we could instead have a set of "core" modules, that are always imported, and then a set of modules that the user can import when they actually want them. If a module uses some other module, it would have to import that other module.
Example usage:
# ~/projects/myPersonalNixosConfig/modules/git.nix
{
imports = [
inputs.hjem-rum.hjemModules.programs.git
];
# `hjr` is hypothetically aliased here
hjr.programs.git.enable = true;
}We could generate these modules automatically, using the filesystem. As long as all programs modules were under the programs/ folder, we could have nested attrsets like seen above. We could also still provide a hjemModules.default entrypoint, for users who don't care about speed and are fine with importing everything - but this gives us a better future plan for preventing a constant growth to eval time as Hjem-Rum grows.