doc: pull option docs out of doc-support
this leaves doc-support as a simple wrapper around function docs. this wrapper will go away very soon as well.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
{ pkgs ? (import ./.. { }), nixpkgs ? { }}:
|
{ pkgs ? (import ./.. { }), nixpkgs ? { }}:
|
||||||
let
|
let
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
inherit (lib) hasPrefix removePrefix;
|
||||||
|
|
||||||
doc-support = import ./doc-support { inherit pkgs nixpkgs; };
|
doc-support = import ./doc-support { inherit pkgs nixpkgs; };
|
||||||
|
|
||||||
epub = pkgs.runCommand "manual.epub" {
|
epub = pkgs.runCommand "manual.epub" {
|
||||||
@@ -43,6 +46,28 @@ let
|
|||||||
zip -0Xq "$out" mimetype
|
zip -0Xq "$out" mimetype
|
||||||
cd scratch && zip -Xr9D "$out" *
|
cd scratch && zip -Xr9D "$out" *
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# NB: This file describes the Nixpkgs manual, which happens to use module
|
||||||
|
# docs infra originally developed for NixOS.
|
||||||
|
optionsDoc = pkgs.nixosOptionsDoc {
|
||||||
|
inherit (pkgs.lib.evalModules {
|
||||||
|
modules = [ ../pkgs/top-level/config.nix ];
|
||||||
|
class = "nixpkgsConfig";
|
||||||
|
}) options;
|
||||||
|
documentType = "none";
|
||||||
|
transformOptions = opt:
|
||||||
|
opt // {
|
||||||
|
declarations =
|
||||||
|
map
|
||||||
|
(decl:
|
||||||
|
if hasPrefix (toString ../..) (toString decl)
|
||||||
|
then
|
||||||
|
let subpath = removePrefix "/" (removePrefix (toString ../.) (toString decl));
|
||||||
|
in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; }
|
||||||
|
else decl)
|
||||||
|
opt.declarations;
|
||||||
|
};
|
||||||
|
};
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.stdenv.mkDerivation {
|
||||||
name = "nixpkgs-manual";
|
name = "nixpkgs-manual";
|
||||||
|
|
||||||
@@ -54,6 +79,7 @@ in pkgs.stdenv.mkDerivation {
|
|||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
ln -s ${doc-support} ./doc-support/result
|
ln -s ${doc-support} ./doc-support/result
|
||||||
|
ln -s ${optionsDoc.optionsJSON}/share/doc/nixos/options.json ./config-options.json
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
{ pkgs ? (import ../.. {}), nixpkgs ? { }}:
|
{ pkgs ? (import ../.. {}), nixpkgs ? { }}:
|
||||||
let
|
let
|
||||||
inherit (pkgs) lib;
|
|
||||||
inherit (lib) hasPrefix removePrefix;
|
|
||||||
|
|
||||||
libsets = [
|
libsets = [
|
||||||
{ name = "asserts"; description = "assertion functions"; }
|
{ name = "asserts"; description = "assertion functions"; }
|
||||||
{ name = "attrsets"; description = "attribute set functions"; }
|
{ name = "attrsets"; description = "attribute set functions"; }
|
||||||
@@ -19,29 +16,6 @@ let
|
|||||||
];
|
];
|
||||||
|
|
||||||
functionDocs = import ./lib-function-docs.nix { inherit pkgs nixpkgs libsets; };
|
functionDocs = import ./lib-function-docs.nix { inherit pkgs nixpkgs libsets; };
|
||||||
version = pkgs.lib.version;
|
|
||||||
|
|
||||||
# NB: This file describes the Nixpkgs manual, which happens to use module
|
|
||||||
# docs infra originally developed for NixOS.
|
|
||||||
optionsDoc = pkgs.nixosOptionsDoc {
|
|
||||||
inherit (pkgs.lib.evalModules {
|
|
||||||
modules = [ ../../pkgs/top-level/config.nix ];
|
|
||||||
class = "nixpkgsConfig";
|
|
||||||
}) options;
|
|
||||||
documentType = "none";
|
|
||||||
transformOptions = opt:
|
|
||||||
opt // {
|
|
||||||
declarations =
|
|
||||||
map
|
|
||||||
(decl:
|
|
||||||
if hasPrefix (toString ../..) (toString decl)
|
|
||||||
then
|
|
||||||
let subpath = removePrefix "/" (removePrefix (toString ../..) (toString decl));
|
|
||||||
in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; }
|
|
||||||
else decl)
|
|
||||||
opt.declarations;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
in pkgs.runCommand "doc-support" {}
|
in pkgs.runCommand "doc-support" {}
|
||||||
''
|
''
|
||||||
@@ -49,7 +23,6 @@ in pkgs.runCommand "doc-support" {}
|
|||||||
(
|
(
|
||||||
cd result
|
cd result
|
||||||
ln -s ${functionDocs} ./function-docs
|
ln -s ${functionDocs} ./function-docs
|
||||||
ln -s ${optionsDoc.optionsJSON} ./config-options.json
|
|
||||||
)
|
)
|
||||||
mv result $out
|
mv result $out
|
||||||
''
|
''
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ The following attributes can be passed in [`config`](#chap-packageconfig).
|
|||||||
```{=include=} options
|
```{=include=} options
|
||||||
id-prefix: opt-
|
id-prefix: opt-
|
||||||
list-id: configuration-variable-list
|
list-id: configuration-variable-list
|
||||||
source: ../doc-support/result/config-options.json/share/doc/nixos/options.json
|
source: ../config-options.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user