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
Add dag library to config.lib
#160
Conversation
modules/modules.nix
Outdated
@@ -74,6 +74,7 @@ let | |||
config._module.args.baseModules = modules; | |||
config._module.args.pkgs = lib.mkDefault pkgs; | |||
config._module.check = check; | |||
config.lib.dag = import lib/dag.nix { inherit lib; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use this opportunity to make it possible to add more general purpose functions to the library. Adding a lib/default.nix
with
{ lib }: {
dag = import ./dag { inherit lib; };
...
}
Then config.lib = import ./lib { inherit lib; };
(or config.lib.home = ...
)
This also calls for a DAG library refactor, such that you can use config.lib.dag.entryAfter
instead of config.lib.dag.dagEntryAfter
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking about the function renaming. Unfortunately it would break the configuration of anybody who uses the dag functions directly.
I'm now thinking the config.lib.dag
entries actually should be different from the dag.nix
file. I.e., to have config.lib.dag = { …; entryAfter = dagEntryAfter; … };
etc. The old dag.nix
could be deprecated and removed in the future.
Also agree on the use of lib/default.nix
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea regarding the slow deprecation
Force-pushed updated code. |
Apparently it also works to just use actual modules, for some reason I don't get recursion when I do this: infinisil@efc486b This also enables having the |
Hmm, when I switch with config.lib;
with lib; to with lib;
with config.lib; e.g. in
with or without your changes. I tried to track this down but unfortunately couldn't find the cause. |
391f1df
to
b0fc32b
Compare
Also replace all imports of `dag.nix` by the entry in `config.lib`.
b0fc32b
to
f0d207f
Compare
Replaced all use of |
Also replace all imports of
dag.nix
by the entry inconfig.lib
.