2015-11-27 18:17:17 +00:00
|
|
|
# Build an idris package
|
2017-11-06 18:18:59 +00:00
|
|
|
{ stdenv, idrisPackages, gmp }:
|
|
|
|
{ idrisDeps ? []
|
|
|
|
, name
|
|
|
|
, version
|
|
|
|
, src
|
|
|
|
, meta
|
|
|
|
, extraBuildInputs ? []
|
|
|
|
, postUnpack ? ""
|
|
|
|
, doCheck ? true
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
idris-with-packages = idrisPackages.with-packages idrisDeps;
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
|
|
|
|
name = "${name}-${version}";
|
|
|
|
|
|
|
|
inherit postUnpack src doCheck meta;
|
|
|
|
|
|
|
|
|
|
|
|
# Some packages use the style
|
|
|
|
# opts = -i ../../path/to/package
|
|
|
|
# rather than the declarative pkgs attribute so we have to rewrite the path.
|
|
|
|
postPatch = ''
|
|
|
|
sed -i *.ipkg -e "/^opts/ s|-i \\.\\./|-i ${idris-with-packages}/libs/|g"
|
2018-02-03 10:12:43 +00:00
|
|
|
'';
|
|
|
|
|
2015-11-27 14:35:59 +00:00
|
|
|
buildPhase = ''
|
2017-11-06 18:18:59 +00:00
|
|
|
${idris-with-packages}/bin/idris --build *.ipkg
|
2015-11-27 14:35:59 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
if grep -q test *.ipkg; then
|
2017-11-06 18:18:59 +00:00
|
|
|
${idris-with-packages}/bin/idris --testpkg *.ipkg
|
2015-11-27 14:35:59 +00:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-11-06 18:18:59 +00:00
|
|
|
${idris-with-packages}/bin/idris --install *.ipkg --ibcsubdir $out/libs
|
2018-07-02 02:33:13 +01:00
|
|
|
IDRIS_DOC_PATH=$out/doc ${idris-with-packages}/bin/idris --installdoc *.ipkg
|
2015-11-27 14:35:59 +00:00
|
|
|
'';
|
2015-11-27 16:03:04 +00:00
|
|
|
|
2017-11-06 18:18:59 +00:00
|
|
|
buildInputs = [ gmp ] ++ extraBuildInputs;
|
|
|
|
|
|
|
|
propagatedBuildInputs = idrisDeps;
|
|
|
|
})
|