1{ libPath
2, pkgsLibPath
3, nixosPath
4, modules
5, stateVersion
6, release
7}:
8
9let
10 lib = import libPath;
11 modulesPath = "${nixosPath}/modules";
12 # dummy pkgs set that contains no packages, only `pkgs.lib` from the full set.
13 # not having `pkgs.lib` causes all users of `pkgs.formats` to fail.
14 pkgs = import pkgsLibPath {
15 inherit lib;
16 pkgs = null;
17 };
18 utils = import "${nixosPath}/lib/utils.nix" {
19 inherit config lib;
20 pkgs = null;
21 };
22 # this is used both as a module and as specialArgs.
23 # as a module it sets the _module special values, as specialArgs it makes `config`
24 # unusable. this causes documentation attributes depending on `config` to fail.
25 config = {
26 _module.check = false;
27 _module.args = {};
28 system.stateVersion = stateVersion;
29 };
30 eval = lib.evalModules {
31 modules = (map (m: "${modulesPath}/${m}") modules) ++ [
32 config
33 ];
34 specialArgs = {
35 inherit config pkgs utils;
36 };
37 };
38 docs = import "${nixosPath}/doc/manual" {
39 pkgs = pkgs // {
40 inherit lib;
41 # duplicate of the declaration in all-packages.nix
42 buildPackages.nixosOptionsDoc = attrs:
43 (import "${nixosPath}/lib/make-options-doc")
44 ({ inherit pkgs lib; } // attrs);
45 };
46 config = config.config;
47 options = eval.options;
48 version = release;
49 revision = "release-${release}";
50 prefix = modulesPath;
51 };
52in
53 docs.optionsNix