From 81d8c2e1c8d4c32f2485e24b286cca67cc66e1b0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 29 May 2009 13:29:49 +0000 Subject: [PATCH] * Move the info wrapper into a module. svn path=/nixos/branches/modular-nixos/; revision=15792 --- helpers/info-wrapper.nix | 29 --------------------------- modules/config/system-path.nix | 1 - modules/module-list.nix | 1 + modules/programs/info.nix | 36 ++++++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 30 deletions(-) delete mode 100644 helpers/info-wrapper.nix create mode 100644 modules/programs/info.nix diff --git a/helpers/info-wrapper.nix b/helpers/info-wrapper.nix deleted file mode 100644 index 0f482dd4c27..00000000000 --- a/helpers/info-wrapper.nix +++ /dev/null @@ -1,29 +0,0 @@ -# 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. - -{bash, texinfo, writeScriptBin}: - -writeScriptBin "info" - '' - #! ${bash}/bin/sh - - 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 "$@" - '' diff --git a/modules/config/system-path.nix b/modules/config/system-path.nix index 3b2867fbb95..4d16b38a1f5 100644 --- a/modules/config/system-path.nix +++ b/modules/config/system-path.nix @@ -57,7 +57,6 @@ let pkgs.usbutils pkgs.utillinux pkgs.wirelesstools - (import ../../helpers/info-wrapper.nix {inherit (pkgs) bash texinfo writeScriptBin;}) ] ++ config.environment.extraPackages; diff --git a/modules/module-list.nix b/modules/module-list.nix index 85d904493a4..b1f701e6a68 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -15,6 +15,7 @@ ./legacy.nix ./misc/assertions.nix ./programs/bash/bash.nix + ./programs/info.nix ./programs/pwdutils/pwdutils.nix ./programs/ssh.nix ./programs/ssmtp.nix diff --git a/modules/programs/info.nix b/modules/programs/info.nix new file mode 100644 index 00000000000..e3b8025f933 --- /dev/null +++ b/modules/programs/info.nix @@ -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]; +}