doc: ensure pkgs is not used in option docs

Providing a stub `pkgs` instance that has no contents ensures the docs
does not _read_ `pkgs` anywhere.
This commit is contained in:
Matt Sturgeon 2025-05-04 03:40:30 +01:00 committed by awwpotato
parent 07af242a44
commit e1ae98f979

View file

@ -14,11 +14,24 @@ let
# Prefix to remove from option declaration file paths.
rootPrefix = toString ../. + "/";
# A stub pkgs used while evaluating the stylix modules for the docs
noPkgs = {
# Needed for type-checking
inherit (pkgs) _type;
# Permit access to (pkgs.formats.foo { }).type
formats = builtins.mapAttrs (_: fmt: args: {
inherit (fmt args) type;
}) pkgs.formats;
};
evalDocs =
module:
lib.evalModules {
modules = [ ./eval_compat.nix ] ++ lib.toList module;
specialArgs = { inherit pkgs; };
specialArgs = {
pkgs = noPkgs;
};
};
# TODO: Include Nix Darwin options