idris: Move library setup to the setup hook.

This was broken in preHook because addEnvHooks isn't defined yet.
This commit is contained in:
Shea Levy 2018-01-20 19:58:06 -05:00
parent 58ff18b6b5
commit 69d4adee1f
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27
3 changed files with 23 additions and 23 deletions

View File

@ -3,40 +3,21 @@
# args: Additional arguments to pass to mkDerivation. Generally should include at least
# name and src.
{ stdenv, idris, gmp }: args: stdenv.mkDerivation ({
preHook = ''
# Library import path
export IDRIS_LIBRARY_PATH=$PWD/idris-libs
mkdir -p $IDRIS_LIBRARY_PATH
# Library install path
export IBCSUBDIR=$out/lib/${idris.name}
mkdir -p $IBCSUBDIR
addIdrisLibs () {
if [ -d $1/lib/${idris.name} ]; then
ln -sv $1/lib/${idris.name}/* $IDRIS_LIBRARY_PATH
fi
}
# All run-time deps
addEnvHooks 0 addIdrisLibs
'';
buildPhase = ''
${idris}/bin/idris --build *.ipkg
idris --build *.ipkg
'';
doCheck = true;
checkPhase = ''
if grep -q test *.ipkg; then
${idris}/bin/idris --testpkg *.ipkg
idris --testpkg *.ipkg
fi
'';
installPhase = ''
${idris}/bin/idris --install *.ipkg --ibcsubdir $IBCSUBDIR
idris --install *.ipkg --ibcsubdir $IBCSUBDIR
'';
buildInputs = [ gmp ];
buildInputs = [ gmp idris ];
} // args)

View File

@ -9,6 +9,9 @@ symlinkJoin {
wrapProgram $out/bin/idris \
--suffix PATH : ${ stdenv.lib.makeBinPath path } \
--suffix LIBRARY_PATH : ${stdenv.lib.makeLibraryPath lib}
mkdir -p $out/nix-support
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
'';
}

View File

@ -0,0 +1,16 @@
# Library import path
export IDRIS_LIBRARY_PATH=$PWD/idris-libs
mkdir -p $IDRIS_LIBRARY_PATH
# Library install path
export IBCSUBDIR=$out/lib/@name@
mkdir -p $IBCSUBDIR
addIdrisLibs () {
if [ -d $1/lib/@name@ ]; then
ln -sv $1/lib/@name@/* $IDRIS_LIBRARY_PATH
fi
}
# All run-time deps
addEnvHooks 1 addIdrisLibs