idris: Clean up package builder
This commit is contained in:
parent
7ec54c61b7
commit
e79b302f89
@ -10,6 +10,8 @@ build-idris-package {
|
||||
inherit name version;
|
||||
inherit (idris) src;
|
||||
|
||||
includePreludeBase = false;
|
||||
|
||||
idrisDeps = deps;
|
||||
|
||||
postUnpack = ''
|
||||
|
@ -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)
|
||||
|
@ -15,6 +15,6 @@ stdenv.lib.appendToName "with-packages" (symlinkJoin {
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/idris \
|
||||
--set IDRIS_LIBRARY_PATH $out/libs
|
||||
'';
|
||||
'';
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user