nixos: generate infodirs directly in system-path

`man 1 info` says:

The first non-option argument, if present, is the menu entry to
start from; it is searched for in all `dir' files along INFOPATH.
If it is not present, info merges all `dir' files and shows the
result. Any remaining arguments are treated as the names of menu
items relative to the initial node visited.

Which means that this does what previous programs/info did and #8519
(on-the-fly infodir generation for Emacs) wanted to do, but for both
programs.

Changed files
+8 -39
nixos
modules
+8
nixos/modules/config/system-path.nix
···
pkgs.strace
pkgs.su
pkgs.time
+
pkgs.texinfoInteractive
pkgs.utillinux
extraManpages
];
···
if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
$out/bin/update-desktop-database $out/share/applications
+
fi
+
+
if [ -x $out/bin/install-info -a -w $out/share/info ]; then
+
shopt -s nullglob
+
for i in $out/share/info/*.info $out/share/info/*.info.gz; do
+
$out/bin/install-info $i $out/share/info/dir
+
done
fi
'';
};
-1
nixos/modules/module-list.nix
···
./programs/command-not-found/command-not-found.nix
./programs/dconf.nix
./programs/environment.nix
-
./programs/info.nix
./programs/ibus.nix
./programs/kbdlight.nix
./programs/light.nix
-38
nixos/modules/programs/info.nix
···
-
{config, pkgs, ...}:
-
-
let
-
-
texinfo = pkgs.texinfoInteractive;
-
-
# Quick hack to make the `info' command work properly. `info' needs
-
# a "dir" file containing all the installed Info files, which we
-
# don't have (it would be impure to have a package installation
-
# update some global "dir" file). So this wrapper script around
-
# "info" builds a temporary "dir" file on the fly. This is a bit
-
# slow (on a cold cache) but not unacceptably so.
-
infoWrapper = pkgs.writeScriptBin "info"
-
''
-
#! ${pkgs.stdenv.shell}
-
-
dir=$(mktemp --tmpdir -d "info.dir.XXXXXX")
-
-
if test -z "$dir"; then exit 1; fi
-
-
trap 'rm -rf "$dir"' EXIT
-
-
shopt -s nullglob
-
-
for i in $(IFS=:; echo $INFOPATH); do
-
for j in $i/*.info; do
-
${texinfo}/bin/install-info --quiet $j $dir/dir
-
done
-
done
-
-
INFOPATH=$dir:$INFOPATH ${texinfo}/bin/info "$@"
-
''; # */
-
-
in
-
-
{
-
environment.systemPackages = [ infoWrapper texinfo ];
-
}