modules/context: init with isDocs

Replaced the `isDocs` specialArg added in #1807 with an internal module
option.

We should only use `specialArgs` when absolutely necessary, a module or
`_module.args` is preferred, but those aren't available until `config`
is evaluated so they can't be used for `imports`.

The main problem with `specialArgs` is it makes our modules less
portable.

Luckily that shouldn't be an issue for these context flags.
This commit is contained in:
Matt Sturgeon 2024-07-05 23:26:05 +01:00
parent edc8602d47
commit 04a255ed7e
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
5 changed files with 20 additions and 6 deletions

View file

@ -3,12 +3,10 @@
config,
lib,
helpers,
specialArgs,
...
}:
let
inherit (lib) types;
isDocs = specialArgs.isDocs or false;
fileModuleType = types.submoduleWith {
shorthandOnlyDefinesConfig = true;
@ -17,7 +15,7 @@ let
defaultPkgs = pkgs;
};
# Don't include the modules in the docs, as that'd be redundant
modules = lib.optionals (!isDocs) [
modules = lib.optionals (!config.isDocs) [
../../.
./submodule.nix
];