diff options
Diffstat (limited to 'manpage.nix')
-rw-r--r-- | manpage.nix | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/manpage.nix b/manpage.nix index bea6b25..c47d88a 100644 --- a/manpage.nix +++ b/manpage.nix | |||
@@ -1,13 +1,16 @@ | |||
1 | { outputAttrPath, optionsAttrPath, optionsInternal ? true, }: | ||
2 | |||
3 | { config, lib, pkgs, ... }: | ||
4 | |||
5 | with lib; | ||
6 | |||
7 | let | ||
8 | cfg = getAttrFromPath (optionsAttrPath ++ [ "manpage" ]) config; | ||
9 | in | ||
10 | { | 1 | { |
2 | outputAttrPath, | ||
3 | optionsAttrPath, | ||
4 | optionsInternal ? true, | ||
5 | }: { | ||
6 | config, | ||
7 | lib, | ||
8 | pkgs, | ||
9 | ... | ||
10 | }: | ||
11 | with lib; let | ||
12 | cfg = getAttrFromPath (optionsAttrPath ++ ["manpage"]) config; | ||
13 | in { | ||
11 | options = setAttrByPath optionsAttrPath { | 14 | options = setAttrByPath optionsAttrPath { |
12 | manpage = { | 15 | manpage = { |
13 | name = mkOption { | 16 | name = mkOption { |
@@ -93,12 +96,12 @@ in | |||
93 | default = ""; | 96 | default = ""; |
94 | internal = optionsInternal; | 97 | internal = optionsInternal; |
95 | }; | 98 | }; |
96 | |||
97 | }; | 99 | }; |
98 | }; | 100 | }; |
99 | 101 | ||
100 | config = setAttrByPath outputAttrPath { | 102 | config = setAttrByPath outputAttrPath { |
101 | manpage = pkgs.runCommand cfg.file | 103 | manpage = |
104 | pkgs.runCommand cfg.file | ||
102 | { | 105 | { |
103 | src = pkgs.writeText "${cfg.file}.md" '' | 106 | src = pkgs.writeText "${cfg.file}.md" '' |
104 | % ${cfg.title} | 107 | % ${cfg.title} |
@@ -128,9 +131,9 @@ in | |||
128 | ${cfg.textAfter} | 131 | ${cfg.textAfter} |
129 | ''; | 132 | ''; |
130 | 133 | ||
131 | nativeBuildInputs = [ pkgs.pandoc ]; | 134 | nativeBuildInputs = [pkgs.pandoc]; |
132 | } '' | 135 | } '' |
133 | pandoc "$src" --from=markdown --to=man --standalone --output="$out" | 136 | pandoc "$src" --from=markdown --to=man --standalone --output="$out" |
134 | ''; | 137 | ''; |
135 | }; | 138 | }; |
136 | } | 139 | } |