Skip to content

Commit

Permalink
wip: manpage
Browse files Browse the repository at this point in the history
  • Loading branch information
nixbitcoin committed Apr 23, 2021
1 parent 8594ddf commit 2265af2
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 0 deletions.
73 changes: 73 additions & 0 deletions docs/man/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{ pkgs ? import <nixpkgs> {} }:

let

lib = pkgs.lib;

nmdSrc = pkgs.fetchFromGitLab {
name = "nmd";
owner = "rycee";
repo = "nmd";
rev = "2398aa79ab12aa7aba14bc3b08a6efd38ebabdc5";
sha256 = "0yxb48afvccn8vvpkykzcr4q1rgv8jsijqncia7a5ffzshcrwrnh";
};

nmd = import nmdSrc { inherit pkgs; };

# Make sure the used package is scrubbed to avoid actually instantiating
# derivations.
#
# Also disable checking since we'll be referring to undefined options.
setupModule = {
imports = [{
_module.args = {
pkgs = lib.mkForce (nmd.scrubDerivations "pkgs" pkgs);
};
_module.check = false;
}];
};

nbModulesDocs = nmd.buildModulesDocs {
modules = let
nixosModule = module: pkgs.path + "/nixos/modules" + module;
in [
../../modules/bitcoind.nix
(nixosModule "/misc/assertions.nix")
setupModule
];
moduleRootPaths = [ ../modules ];
mkModuleUrl = path:
"https://github.com/fort-nix/nix-bitcoin/blob/master/${path}#blob-path";
channelName = "nix-bitcoin";
docBook.id = "nb-options";
};

docs = nmd.buildDocBookDocs {
pathName = "nix-bitcoin";
modulesDocs = [ nbModulesDocs ];
documentsDirectory = ./.;
chunkToc = ''
<toc>
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-nix-bitcoin-manual"><?dbhtml filename="index.html"?>
<d:tocentry linkend="ch-nb-options"><?dbhtml filename="nb-options.html"?></d:tocentry>
</d:tocentry>
</toc>
'';
};

in {
options = {
json = pkgs.symlinkJoin {
name = "nix-bitcoin-options-json";
paths = [
(nbModulesDocs.json.override {
path = "share/doc/nix-bitcoin/nb-options.json";
})
];
};
};

manPages = docs.manPages;

manual = { inherit (docs) html htmlOpenTool; };
}
27 changes: 27 additions & 0 deletions docs/man/man-nb-options.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<refentry xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refmeta>
<refentrytitle><filename>nb-options</filename>
</refentrytitle><manvolnum>5</manvolnum>
<refmiscinfo class="source">nix-bitcoin</refmiscinfo>
</refmeta>
<refnamediv>
<refname><filename>nb-options</filename>
</refname><refpurpose>nix-bitcoin configuration specification</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>
This contains the nix-bitcoin module options.
</para>
</refsection>
<refsection>
<title>Options</title>
<para>
You can use the following options in <filename>configuration.nix</filename>:
</para>
<xi:include href="./nmd-result/nb-options.xml" />
</refsection>
</refentry>

13 changes: 13 additions & 0 deletions docs/man/man-pages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<reference xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>nix-bitcoin Reference Pages</title>
<info>
<author><personname>nix-bitcoin developers</personname>
</author>
<copyright><year>2021</year><holder>nix-bitcoin developers</holder>
</copyright>
</info>
<xi:include href="man-nb-options.xml" />
</reference>

32 changes: 32 additions & 0 deletions docs/man/manual.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="book-nix-bitcoin-manual">
<info>
<title>nix-bitcoin</title>
</info>
<preface>
<title>Preface</title>
<para>
Documentation of nix-bitcoin options.
</para>
<para>
If you encounter problems or bugs then please report them on the <link xlink:href="https://gitlab.com/rycee/nur-expressions/issues">issue tracker</link>.
</para>
</preface>
<appendix xml:id="ch-nb-options">
<title>nix-bitcoin configuration options</title>
<section xml:id="sec-nb-usage">
<title>Usage</title>
<para>
To use these options modify your <filename>configuration.nix</filename> such that it has the format
</para>
</section>
<section xml:id="sec-nb-options">
<title>Options</title>

<xi:include href="./nmd-result/nb-options.xml" />
</section>
</appendix>
</book>

0 comments on commit 2265af2

Please sign in to comment.