nixos/mandoc: use MANPATH environment variable
This commit is contained in:
parent
ab222895b1
commit
4f3e29f3a3
1 changed files with 16 additions and 7 deletions
|
@ -18,13 +18,14 @@ in
|
||||||
default = [ "share/man" ];
|
default = [ "share/man" ];
|
||||||
example = lib.literalExpression "[ \"share/man\" \"share/man/fr\" ]";
|
example = lib.literalExpression "[ \"share/man\" \"share/man/fr\" ]";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Change the manpath, i. e. the directories where
|
Change the paths included in MANPATH environment variable,
|
||||||
{manpage}`man(1)`
|
i. e. the directories where {manpage}`man(1)`
|
||||||
looks for section-specific directories of man pages.
|
looks for section-specific directories of man pages.
|
||||||
You only need to change this setting if you want extra man pages
|
You only need to change this setting if you want extra man pages
|
||||||
(e. g. in non-english languages). All values must be strings that
|
(e. g. in non-english languages). All values must be strings that
|
||||||
are a valid path from the target prefix (without including it).
|
are a valid path from the target prefix (without including it).
|
||||||
The first value given takes priority.
|
The first value given takes priority. Note that this is not
|
||||||
|
adding manpath in {manpage}`man.conf(5)`.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,6 +38,14 @@ in
|
||||||
configuration options used for the package.
|
configuration options used for the package.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraConfig = lib.mkOption {
|
||||||
|
type = lib.types.lines;
|
||||||
|
default = "";
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
Configuration to write to {manpage}`man.conf(5)`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,10 +53,7 @@ in
|
||||||
environment = {
|
environment = {
|
||||||
systemPackages = [ cfg.package ];
|
systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
# tell mandoc about man pages
|
etc."man.conf".text = cfg.extraConfig;
|
||||||
etc."man.conf".text = lib.concatMapStrings (path: ''
|
|
||||||
manpath /run/current-system/sw/${path}
|
|
||||||
'') cfg.manPath;
|
|
||||||
|
|
||||||
# create mandoc.db for whatis(1), apropos(1) and man(1) -k
|
# create mandoc.db for whatis(1), apropos(1) and man(1) -k
|
||||||
# TODO(@sternenseemman): fix symlinked directories not getting indexed,
|
# TODO(@sternenseemman): fix symlinked directories not getting indexed,
|
||||||
|
@ -58,6 +64,9 @@ in
|
||||||
[[ -d "$man_path" ]] && ${makewhatis} -T utf8 $man_path
|
[[ -d "$man_path" ]] && ${makewhatis} -T utf8 $man_path
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# tell mandoc the paths containing man pages
|
||||||
|
profileRelativeSessionVariables."MANPATH" = map (path: "/${path}") cfg.manPath;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue