From 19a1534e61042d456fb222ea25d3443667aeddab Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 20 Dec 2021 22:49:23 +0100 Subject: [PATCH] modules/documentation/default.nix: Fix args warning --- modules/documentation/default.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/documentation/default.nix b/modules/documentation/default.nix index 34a75ca4..6bd34121 100644 --- a/modules/documentation/default.nix +++ b/modules/documentation/default.nix @@ -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