Skip to content

Find a long-term solution to increasing eval times #65

@llakala

Description

@llakala

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions