2015-11-27 19:17:17 +01:00
|
|
|
# Build an idris package
|
|
|
|
#
|
|
|
|
# args: Additional arguments to pass to mkDerivation. Generally should include at least
|
|
|
|
# name and src.
|
|
|
|
{ stdenv, idris, gmp }: args: stdenv.mkDerivation ({
|
2015-11-27 15:35:59 +01:00
|
|
|
preHook = ''
|
2017-08-23 02:49:25 +02:00
|
|
|
# Library import path
|
2015-11-27 15:35:59 +01:00
|
|
|
export IDRIS_LIBRARY_PATH=$PWD/idris-libs
|
2017-08-23 02:49:25 +02:00
|
|
|
mkdir -p $IDRIS_LIBRARY_PATH
|
|
|
|
|
|
|
|
# Library install path
|
|
|
|
export IBCSUBDIR=$out/lib/${idris.name}
|
|
|
|
mkdir -p $IBCSUBDIR
|
2015-11-27 15:35:59 +01:00
|
|
|
|
|
|
|
addIdrisLibs () {
|
|
|
|
if [ -d $1/lib/${idris.name} ]; then
|
|
|
|
ln -sv $1/lib/${idris.name}/* $IDRIS_LIBRARY_PATH
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
envHooks+=(addIdrisLibs)
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
${idris}/bin/idris --build *.ipkg
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
if grep -q test *.ipkg; then
|
|
|
|
${idris}/bin/idris --testpkg *.ipkg
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-08-23 02:49:25 +02:00
|
|
|
${idris}/bin/idris --install *.ipkg --ibcsubdir $IBCSUBDIR
|
2015-11-27 15:35:59 +01:00
|
|
|
'';
|
2015-11-27 17:03:04 +01:00
|
|
|
|
|
|
|
buildInputs = [ gmp ];
|
2015-11-27 19:17:17 +01:00
|
|
|
} // args)
|