nixos/documentation: Allow the inclusion of a nixpkgs/modules directory

Changed files
+20 -2
ci
nixos
+1
ci/eval/default.nix
···
"doc"
"lib"
"maintainers"
+
"modules"
"nixos"
"pkgs"
".version"
+1
nixos/lib/eval-cacheable-options.nix
···
version = release;
revision = "release-${release}";
prefix = modulesPath;
+
extraSources = [ (dirOf nixosPath) ];
};
in
docs.optionsNix
+18 -2
nixos/modules/misc/documentation.nix
···
&& (t == "directory" -> baseNameOf n != "tests")
&& (t == "file" -> hasSuffix ".nix" n)
);
+
prefixRegex = "^" + lib.strings.escapeRegex (toString pkgs.path) + "($|/(modules|nixos)($|/.*))";
+
filteredModules = builtins.path {
+
name = "source";
+
inherit (pkgs) path;
+
filter =
+
n: t:
+
builtins.match prefixRegex n != null
+
&& cleanSourceFilter n t
+
&& (t == "directory" -> baseNameOf n != "tests")
+
&& (t == "file" -> hasSuffix ".nix" n);
+
};
in
pkgs.runCommand "lazy-options.json"
-
{
+
rec {
libPath = filter (pkgs.path + "/lib");
pkgsLibPath = filter (pkgs.path + "/pkgs/pkgs-lib");
-
nixosPath = filter (pkgs.path + "/nixos");
+
nixosPath = filteredModules + "/nixos";
NIX_ABORT_ON_WARN = warningsAreErrors;
modules =
"[ "
+ concatMapStringsSep " " (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy
+ " ]";
passAsFile = [ "modules" ];
+
disallowedReferences = [
+
filteredModules
+
libPath
+
pkgsLibPath
+
];
}
''
export NIX_STORE_DIR=$TMPDIR/store