* Move the info wrapper into a module.

svn path=/nixos/branches/modular-nixos/; revision=15792
This commit is contained in:
Eelco Dolstra
2009-05-29 13:29:49 +00:00
parent 548fb6a1a5
commit 81d8c2e1c8
4 changed files with 37 additions and 30 deletions

36
modules/programs/info.nix Normal file
View File

@@ -0,0 +1,36 @@
{config, pkgs, ...}:
let
# 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
${pkgs.texinfo}/bin/install-info --quiet $j $dir/dir
done
done
INFOPATH=$dir:$INFOPATH ${pkgs.texinfo}/bin/info "$@"
''; # */
in
{
environment.systemPackages = [infoWrapper];
}