docs: add html and man pages for options

This commit is contained in:
Tobias Happ 2022-10-26 11:24:22 +02:00
parent 8687e3d6da
commit f62cd709c8
5 changed files with 191 additions and 7 deletions

55
docs/default.nix Normal file
View file

@ -0,0 +1,55 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ pkgs, home-manager, nmdSrc }:
let
nmd = import nmdSrc { inherit pkgs; };
# Make sure the used package is scrubbed to avoid actually instantiating
# derivations.
setupModule = {
_module.args.pkgs = pkgs.lib.mkForce (nmd.scrubDerivations "pkgs" pkgs);
};
modules = import ../modules/module-list.nix {
inherit pkgs;
home-manager-path = home-manager.outPath;
isFlake = true;
};
modulesDocs = nmd.buildModulesDocs {
modules = modules ++ [ setupModule ];
moduleRootPaths = [ ../. ];
mkModuleUrl = path: "https://github.com/t184256/nix-on-droid/blob/master/${path}";
channelName = "nix-on-droid";
docBook.id = "nix-on-droid-options";
};
docs = nmd.buildDocBookDocs {
pathName = "nix-on-droid";
modulesDocs = [ modulesDocs ];
documentsDirectory = ./.;
chunkToc = ''
<toc>
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-manual"><?dbhtml filename="index.html"?>
<d:tocentry linkend="ch-options"><?dbhtml filename="nix-on-droid-options.html"?></d:tocentry>
</d:tocentry>
</toc>
'';
};
in
{
inherit (docs) manPages;
optionsJson = pkgs.symlinkJoin {
name = "nix-on-droid-options-json";
paths = [
(modulesDocs.json.override {
path = "share/doc/nix-on-droid/nix-on-droid-options.json";
})
];
};
manualHtml = docs.html;
}

38
docs/man-pages.xml Normal file
View file

@ -0,0 +1,38 @@
<!-- Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. -->
<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-on-Droid Reference Pages</title>
<info>
<author><personname>Nix-on-Droid contributors</personname>
</author>
<copyright><year>2022</year><holder>Nix-on-Droid contributors</holder>
</copyright>
</info>
<refentry>
<refmeta>
<refentrytitle><filename>nix-on-droid-options</filename></refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo class="source">Nix-on-Droid</refmiscinfo>
</refmeta>
<refnamediv>
<refname><filename>nix-on-droid-options</filename>
</refname><refpurpose>Nix-on-Droid configuration specification</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>
This contains the module options available for Nix-on-Droid.
</para>
</refsection>
<refsection>
<title>Options</title>
<para>
You can use the following options in <filename>nix-on-droid.nix</filename> or in the
<varname>modules</varname> argument of <varname>lib.nixOnDroidConfiguration</varname>
in your <filename>flake.nix</filename>:
</para>
<xi:include href="./nmd-result/nix-on-droid-options.xml" />
</refsection>
</refentry>
</reference>

59
docs/manual.xml Normal file
View file

@ -0,0 +1,59 @@
<!-- Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. -->
<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-manual">
<info>
<title>Nix-on-Droid manual</title>
</info>
<preface>
<title>Preface</title>
<para>
Some basic documentation of Nix-on-Droid.
</para>
<para>
If you encounter problems or bugs then please report them on the
<link xlink:href="https://github.com/t184256/nix-on-droid/issues">issue tracker</link>.
</para>
</preface>
<appendix xml:id="ch-options">
<title>Nix-on-Droid configuration options</title>
<section xml:id="sec-usage">
<title>Usage</title>
<para>
To use these options, edit the config file in
<filename>~/.config/nixpkgs/nix-on-droid.nix</filename> or in case of a flake setup,
set the <replaceable>modules</replaceable> value in the <varname>nixOnDroidConfiguration</varname>
call:
<programlisting language="nix">
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
nix-on-droid = {
url = "github:t184256/nix-on-droid/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nix-on-droid }: {
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
<replaceable>modules</replaceable> = [ ./nix-on-droid.nix ];
};
};
}
</programlisting>
</para>
</section>
<section xml:id="sec-options">
<title>Options</title>
<xi:include href="./nmd-result/nix-on-droid-options.xml" />
</section>
</appendix>
</book>