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