Make all _module.args available in moduleArgs

This commit is contained in:
Archit Gupta 2024-08-03 11:17:51 -07:00
parent 60d8e0525f
commit a1e3b8bc3e
3 changed files with 22 additions and 18 deletions

View File

@ -58,7 +58,7 @@ The following module arguments are available:
- `inputs`: value of inputs option
- `outputs`: resulting output (i.e. final flake attributes)
- `pkgsFor`: attrset mapping systems to the pkgs set for that system
- `moduleArgs`: All of the above arguments (passed to auto-loaded files)
- `moduleArgs`: All of the available arguments (passed to auto-loaded files)
## Additional pkgs values

View File

@ -2,19 +2,7 @@
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
# SPDX-License-Identifier: MIT
{ config
, options
, src
, lib
, flakelight
, inputs
, outputs
, pkgsFor
, genSystems
, specialArgs
, modulesPath
, moduleArgs
}@args:
{ config, ... }@args:
{
_module.args.moduleArgs = args;
_module.args.moduleArgs = args // config._module.args;
}

View File

@ -69,15 +69,31 @@ in
}))
(f: f.test);
outputs-moduleArgs = test
moduleArgs = test
(flakelight ./empty ({ moduleArgs, ... }: {
outputs = { inherit moduleArgs; };
}))
(f: f.moduleArgs ? lib
(f: f.moduleArgs ? config
&& f.moduleArgs ? options
&& f.moduleArgs ? src
&& f.moduleArgs ? lib
&& f.moduleArgs ? flakelight
&& f.moduleArgs ? inputs
&& f.moduleArgs ? outputs
&& f.moduleArgs ? flakelight);
&& f.moduleArgs ? pkgsFor
&& f.moduleArgs ? specialArgs
&& f.moduleArgs ? modulesPath
&& f.moduleArgs ? moduleArgs
);
moduleArgs-add = test
(flakelight ./empty {
_module.args.test-val = true;
outputs = { test-val, ... }: {
test = test-val;
};
})
(f: f.test);
extra-pkgs-vals = test
(flakelight ./empty {