home-manager/modules/manual.nix
Emily 36a53d9f26 treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.

To reproduce this commit, run:

  $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
    nix shell nixpkgs#coreutils \
    -c find . -name '*.nix' \
    -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
    {} +
  $ ./format

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
2023-07-17 18:40:56 +01:00

70 lines
1.9 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.manual;
docs = import ../docs {
inherit pkgs lib;
inherit (config.home.version) release isReleaseBranch;
};
in {
options = {
manual.html.enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Whether to install the HTML manual. This also installs the
{command}`home-manager-help` tool, which opens a local
copy of the Home Manager manual in the system web browser.
'';
};
manual.manpages.enable = mkOption {
type = types.bool;
default = true;
example = false;
description = lib.mdDoc ''
Whether to install the configuration manual page. The manual can
be reached by {command}`man home-configuration.nix`.
When looking at the manual page pretend that all references to
NixOS stuff are actually references to Home Manager stuff.
Thanks!
'';
};
manual.json.enable = mkOption {
type = types.bool;
default = false;
example = true;
description = lib.mdDoc ''
Whether to install a JSON formatted list of all Home Manager
options. This can be located at
{file}`<profile directory>/share/doc/home-manager/options.json`,
and may be used for navigating definitions, auto-completing,
and other miscellaneous tasks.
'';
};
};
config = {
home.packages = mkMerge [
(mkIf cfg.html.enable [ docs.manual.html docs.manual.htmlOpenTool ])
(mkIf cfg.manpages.enable [ docs.manPages ])
(mkIf cfg.json.enable [ docs.options.json ])
];
# Whether a dependency on nmd should be introduced.
home.extraBuilderCommands =
mkIf (cfg.html.enable || cfg.manpages.enable || cfg.json.enable) ''
mkdir $out/lib
ln -s ${docs.nmdSrc} $out/lib/nmd
'';
};
}