summaryrefslogtreecommitdiffstats
path: root/manpage.nix
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2022-12-08 09:11:49 +0100
committerMinijackson <minijackson@riseup.net>2022-12-08 09:11:49 +0100
commitd488feb4b2a586071fdb28309858747549670903 (patch)
tree0144d7d0f13e090730b757822b04aa58c75d9175 /manpage.nix
parent90311e2493118c53e6e4b2a8d5a786b929ae44e4 (diff)
downloadnix-module-doc-d488feb4b2a586071fdb28309858747549670903.tar.gz
nix-module-doc-d488feb4b2a586071fdb28309858747549670903.zip
treewide: fmt with alejandra
Diffstat (limited to 'manpage.nix')
-rw-r--r--manpage.nix31
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
5with lib;
6
7let
8 cfg = getAttrFromPath (optionsAttrPath ++ [ "manpage" ]) config;
9in
10{ 1{
2 outputAttrPath,
3 optionsAttrPath,
4 optionsInternal ? true,
5}: {
6 config,
7 lib,
8 pkgs,
9 ...
10}:
11with lib; let
12 cfg = getAttrFromPath (optionsAttrPath ++ ["manpage"]) config;
13in {
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}