fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
1.8 KiB69 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.manual;
8
9  docs = import ../docs {
10    inherit pkgs lib;
11    inherit (config.home.version) release isReleaseBranch;
12  };
13
14in {
15  options = {
16    manual.html.enable = mkOption {
17      type = types.bool;
18      default = false;
19      description = ''
20        Whether to install the HTML manual. This also installs the
21        {command}`home-manager-help` tool, which opens a local
22        copy of the Home Manager manual in the system web browser.
23      '';
24    };
25
26    manual.manpages.enable = mkOption {
27      type = types.bool;
28      default = true;
29      example = false;
30      description = ''
31        Whether to install the configuration manual page. The manual can
32        be reached by {command}`man home-configuration.nix`.
33
34        When looking at the manual page pretend that all references to
35        NixOS stuff are actually references to Home Manager stuff.
36        Thanks!
37      '';
38    };
39
40    manual.json.enable = mkOption {
41      type = types.bool;
42      default = false;
43      example = true;
44      description = ''
45        Whether to install a JSON formatted list of all Home Manager
46        options. This can be located at
47        {file}`<profile directory>/share/doc/home-manager/options.json`,
48        and may be used for navigating definitions, auto-completing,
49        and other miscellaneous tasks.
50      '';
51    };
52  };
53
54  config = {
55    home.packages = mkMerge [
56      (mkIf cfg.html.enable [ docs.manual.html docs.manual.htmlOpenTool ])
57      (mkIf cfg.manpages.enable [ docs.manPages ])
58      (mkIf cfg.json.enable [ docs.options.json ])
59    ];
60
61    # Whether a dependency on nmd should be introduced.
62    home.extraBuilderCommands =
63      mkIf (cfg.html.enable || cfg.manpages.enable || cfg.json.enable) ''
64        mkdir $out/lib
65        ln -s ${docs.nmdSrc} $out/lib/nmd
66      '';
67  };
68
69}