nixos/documentation: Allow the inclusion of a nixpkgs/modules directory
This commit is contained in:
@@ -31,6 +31,7 @@ let
|
|||||||
"doc"
|
"doc"
|
||||||
"lib"
|
"lib"
|
||||||
"maintainers"
|
"maintainers"
|
||||||
|
"modules"
|
||||||
"nixos"
|
"nixos"
|
||||||
"pkgs"
|
"pkgs"
|
||||||
".version"
|
".version"
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ let
|
|||||||
version = release;
|
version = release;
|
||||||
revision = "release-${release}";
|
revision = "release-${release}";
|
||||||
prefix = modulesPath;
|
prefix = modulesPath;
|
||||||
|
extraSources = [ (dirOf nixosPath) ];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
docs.optionsNix
|
docs.optionsNix
|
||||||
|
|||||||
@@ -116,18 +116,34 @@ let
|
|||||||
&& (t == "directory" -> baseNameOf n != "tests")
|
&& (t == "directory" -> baseNameOf n != "tests")
|
||||||
&& (t == "file" -> hasSuffix ".nix" n)
|
&& (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
|
in
|
||||||
pkgs.runCommand "lazy-options.json"
|
pkgs.runCommand "lazy-options.json"
|
||||||
{
|
rec {
|
||||||
libPath = filter (pkgs.path + "/lib");
|
libPath = filter (pkgs.path + "/lib");
|
||||||
pkgsLibPath = filter (pkgs.path + "/pkgs/pkgs-lib");
|
pkgsLibPath = filter (pkgs.path + "/pkgs/pkgs-lib");
|
||||||
nixosPath = filter (pkgs.path + "/nixos");
|
nixosPath = filteredModules + "/nixos";
|
||||||
NIX_ABORT_ON_WARN = warningsAreErrors;
|
NIX_ABORT_ON_WARN = warningsAreErrors;
|
||||||
modules =
|
modules =
|
||||||
"[ "
|
"[ "
|
||||||
+ concatMapStringsSep " " (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy
|
+ concatMapStringsSep " " (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy
|
||||||
+ " ]";
|
+ " ]";
|
||||||
passAsFile = [ "modules" ];
|
passAsFile = [ "modules" ];
|
||||||
|
disallowedReferences = [
|
||||||
|
filteredModules
|
||||||
|
libPath
|
||||||
|
pkgsLibPath
|
||||||
|
];
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
export NIX_STORE_DIR=$TMPDIR/store
|
export NIX_STORE_DIR=$TMPDIR/store
|
||||||
|
|||||||
Reference in New Issue
Block a user