From 80d32b8eb98276337f8c9ae9ad9b7e2af74e3ae9 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sat, 7 Aug 2021 17:03:18 +0200 Subject: machines/sterneseemann/base: hack around makewhatis(8) ignoring secs buildEnv is conservative with creating symlinks, i. e. it only creates directories if it has to. Consequently if a directory is only present in a single package in the environment, it'll be a symlink. Enter: makewhatis(8), a tool that has never imagined a creation as accursed as Nix or even NixOS. Thus it assumes that probably no one ever uses symlinks in their man directory and if they do, it'll be to alias man pages. Consequently it assumes that all symbolic links are files [1] and ignores them in the normal mode because they are in the wrong place. To still be able to use apropos(1) with POSIX man pages, introduce this shell hack to re-create the symlinked directories before building mandoc's db. [1]: See also https://inbox.vuxu.org/mandoc-tech/bccac2cd-01b6-b349-86e5-de4066ed8dee@systemli.org/T/#u --- machines/sternenseemann/base.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'machines/sternenseemann/base.nix') diff --git a/machines/sternenseemann/base.nix b/machines/sternenseemann/base.nix index 2ab04672..27da863d 100644 --- a/machines/sternenseemann/base.nix +++ b/machines/sternenseemann/base.nix @@ -66,6 +66,33 @@ in { manPath = [ "share/man" "share/man/de" ]; }; + # HACK: create man0p, man1p, man3p etc. as directories in the environment + # out path to work around the makewhatis(8) bug that it always assumes + # symlinks are files. Since man3p etc. comes from a single package, + # buildEnv just symlinks the entire directory and makewhatis(8) then + # ignores it. + environment.extraSetup = lib.mkBefore '' + for dir in $out/share/man/*; do + section="$(basename "$dir")" + sectionDir="$out/share/man/$section" + + if test -L "$sectionDir"; then + dest="$(realpath "$sectionDir")" + + if test -d "$dest"; then + echo "Recreating $sectionDir and linking everything from $dest..." 1>&2 + + rm "$sectionDir" + mkdir "$sectionDir" + + for f in "$dest"/*; do + ln -s "$f" -t "$sectionDir" + done + fi + fi + done + ''; + environment.systemPackages = with pkgs; [ curl wget man-pages -- cgit 1.4.1