1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

Merge pull request #409 from hercules-ci/fix-args-warning

eval-config.nix: Fix args warning
This commit is contained in:
Daiderd Jordan 2022-01-02 20:38:46 +01:00 committed by GitHub
commit 15635ae638
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View file

@ -8,10 +8,12 @@
}@args:
let
inputsModule = {
argsModule = {
_file = ./eval-config.nix;
config = {
_module.args.inputs = inputs;
_module.args = {
inherit baseModules inputs modules;
};
};
};
@ -33,8 +35,7 @@ let
});
eval = libExtended.evalModules (builtins.removeAttrs args [ "inputs" "system" ] // {
modules = modules ++ [ inputsModule pkgsModule ] ++ baseModules;
args = { inherit baseModules modules; };
modules = modules ++ [ argsModule pkgsModule ] ++ baseModules;
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;
});

View file

@ -5,6 +5,17 @@ with lib;
let
cfg = config.documentation;
# To reference the regular configuration from inside the docs evaluation further down.
# While not strictly necessary, this extra binding avoids accidental name capture in
# the future.
regularConfig = config;
argsModule = {
config._module.args = regularConfig._module.args // {
modules = [ ];
};
};
/* For the purpose of generating docs, evaluate options with each derivation
in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}".
It isn't perfect, but it seems to cover a vast majority of use cases.
@ -17,8 +28,7 @@ let
options =
let
scrubbedEval = evalModules {
modules = baseModules;
args = (config._module.args) // { modules = [ ]; };
modules = baseModules ++ [ argsModule ];
specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; };
};
scrubDerivations = namePrefix: pkgSet: mapAttrs