hive icon indicating copy to clipboard operation
hive copied to clipboard

Draft: feat: use a custom haumea loader

Open korrat opened this issue 11 months ago • 3 comments

This patch replaces the scoped loader used in load with a custom version that can resolve module arguments as well.

korrat avatar Mar 15 '24 12:03 korrat

Once #32 is merged, we can rebase this branch on top of main.

One problem of this patch is that the scoped functionality does not match the function version exactly, due to the way the imports work. I don't believe that will be fixable. Therefore, I left the pkgs argument on the module definition in load. Consumers can then rely on cell, config, inputs, lib, modulesPath, options, and pkgs being in scope, while for all other arguments, they would have to declare a function. Is that a good compromise?

korrat avatar Mar 15 '24 12:03 korrat

We might want to move defaultWith/loader/load/findLoad into individual source files to clean up flake.nix.

korrat avatar Mar 15 '24 12:03 korrat

The first commit (apart from the one included in #32) works with https://github.com/Lord-Valen/configuration.nix.

The second commit replaces the custom loader implementation with applyModuleArgsIfFunction, mostly. However, that causes some failures, since now config, lib, and options are always passed. Could be worth it for the reduced maintenance, but would cause some more churn for users. Also, it yields a warning about external calls to the function being deprecated.

korrat avatar Mar 15 '24 17:03 korrat