Documentation Gaps: Difference between revisions
imported>Jtojnar mNo edit summary |
imported>Laikq add section about manpages / pathsToLink / buildEnv |
||
Line 55: | Line 55: | ||
And an explanation of what they do and what they are used for. | And an explanation of what they do and what they are used for. | ||
== How do manpages work? Or: <code>environment.pathsToLink</code> and <code>buildEnv</code> == | |||
I'm trying to understand how manpages work in Nix/NixOS. | |||
There is a pacakge called [https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/man-db/default.nix#L29 <code>man-db</code>], which seems to be looking in <code>/nix/var/nix/profiles/default/share/man</code> for manpages. It can build a cache at <code>/var/cache/man/nixpkgs</code>. | |||
Under NixOS (on my machine, running NixOS 20.09), these paths do not exist. <code>man-db</code> is installed as a NixOS module, the configuration is at [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/misc/documentation.nix#L104 <code>nixos/modules/misc/documentation.nix</code>] in the nixpkgs repository. Manpages are in <code>/run/current-system/sw/share/man</code>, and the cache resides in <code>/var/cache/man/nixos</code>. | |||
What I don't understand is: How are these paths populated? In the module, if <code>man</code> is enabled, <code>environment.pathsToLink</code> is set to <code>[ "/share/man" ]</code>. The documentation describes this option as "List of directories to be symlinked in /run/current-system/sw". Does this mean that for every package in <code>environment.systemPackages</code>, it does something like <code>for f in ${pkg}/share/man/* ; do ln -s $f /run/current-system/sw/share/man/$fname ; done</code>? I could only find that <code>environment.systemPackages</code> is later used to make a <code>buildEnv</code>, but what <code>buildEnv</code> does is a mystery to me. | |||
So, to summarize my ramblings, I guess I would find a thorough documentation of buildEnv very helpful. |