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 name version;
inherit (idris) src; inherit (idris) src;
includePreludeBase = false;
idrisDeps = deps; idrisDeps = deps;
postUnpack = '' postUnpack = ''

View File

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

View File

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