diff --git a/pkgs/development/libraries/slib/default.nix b/pkgs/development/libraries/slib/default.nix index db85f5233526..952d4ba9f255 100644 --- a/pkgs/development/libraries/slib/default.nix +++ b/pkgs/development/libraries/slib/default.nix @@ -27,12 +27,14 @@ stdenv.mkDerivation rec { SCHEME_LIBRARY_PATH="$out/lib/slib" make catalogs sed -i "$out/bin/slib" \ - -e "/^SCHEME_LIBRARY_PATH/i export PATH=\"${scheme}/bin:$PATH\"" + -e "/^SCHEME_LIBRARY_PATH/i export PATH=\"${scheme}/bin:\$PATH\"" ''; # There's no test suite (?!). doCheck = false; + setupHook = ./setup-hook.sh; + meta = { description = "The SLIB Portable Scheme Library"; diff --git a/pkgs/development/libraries/slib/setup-hook.sh b/pkgs/development/libraries/slib/setup-hook.sh new file mode 100644 index 000000000000..32dde7d1f7a2 --- /dev/null +++ b/pkgs/development/libraries/slib/setup-hook.sh @@ -0,0 +1,13 @@ +addSlibPath () { + if test -f "$1/lib/slib/slibcat" + then + export SCHEME_LIBRARY_PATH="$1/lib/slib/" + echo "SLIB found in \`$1'; setting \$SCHEME_LIBRARY_PATH to \`$SCHEME_LIBRARY_PATH'" + + # This is needed so that `(load-from-path "slib/guile.init")' works. + export GUILE_LOAD_PATH="$1/lib:$GUILE_LOAD_PATH" + echo "SLIB: setting \$GUILE_LOAD_PATH to \`$GUILE_LOAD_PATH'" + fi +} + +envHooks=(${envHooks[@]} addSlibPath)