idris: Clean up package builder

This commit is contained in:
Silvan Mosberger 2018-07-02 05:18:08 +02:00
parent 7ec54c61b7
commit e79b302f89
No known key found for this signature in database
GPG Key ID: 9424360B4B85C9E7
3 changed files with 21 additions and 19 deletions

View File

@ -10,6 +10,8 @@ build-idris-package {
inherit name version;
inherit (idris) src;
includePreludeBase = false;
idrisDeps = deps;
postUnpack = ''

View File

@ -1,23 +1,26 @@
# Build an idris package
{ stdenv, idrisPackages, gmp }:
{ stdenv, lib, idrisPackages, gmp }:
{ idrisDeps ? []
, includePreludeBase ? true
, name
, version
, src
, meta
, extraBuildInputs ? []
, postUnpack ? ""
, doCheck ? true
}:
, ...
}@attrs:
let
idris-with-packages = idrisPackages.with-packages idrisDeps;
idrisDeps' = idrisDeps ++ lib.optionals includePreludeBase (with idrisPackages; [ prelude base ]);
idris-with-packages = idrisPackages.with-packages idrisDeps';
newAttrs = builtins.removeAttrs attrs [ "idrisDeps" "extraBuildInputs" "name" "version" ] // {
meta = attrs.meta // {
platforms = attrs.meta.platforms or idrisPackages.idris.meta.platforms;
};
};
in
stdenv.mkDerivation ({
name = "${name}-${version}";
inherit postUnpack src doCheck meta;
buildInputs = [ idris-with-packages gmp ] ++ extraBuildInputs;
propagatedBuildInputs = idrisDeps';
# Some packages use the style
# opts = -i ../../path/to/package
@ -27,21 +30,18 @@ stdenv.mkDerivation ({
'';
buildPhase = ''
${idris-with-packages}/bin/idris --build *.ipkg
idris --build *.ipkg
'';
checkPhase = ''
if grep -q test *.ipkg; then
${idris-with-packages}/bin/idris --testpkg *.ipkg
idris --testpkg *.ipkg
fi
'';
installPhase = ''
${idris-with-packages}/bin/idris --install *.ipkg --ibcsubdir $out/libs
IDRIS_DOC_PATH=$out/doc ${idris-with-packages}/bin/idris --installdoc *.ipkg
idris --install *.ipkg --ibcsubdir $out/libs
IDRIS_DOC_PATH=$out/doc idris --installdoc *.ipkg || true
'';
buildInputs = [ gmp ] ++ extraBuildInputs;
propagatedBuildInputs = idrisDeps;
})
} // newAttrs)

View File

@ -15,6 +15,6 @@ stdenv.lib.appendToName "with-packages" (symlinkJoin {
postBuild = ''
wrapProgram $out/bin/idris \
--set IDRIS_LIBRARY_PATH $out/libs
'';
'';
})