build-idris-package: ipkgName

This commit is contained in:
TG x
2018-09-18 10:38:59 +02:00
parent 14d646edec
commit 7e0f7a0b54
23 changed files with 40 additions and 41 deletions
@@ -5,6 +5,7 @@
, noBase ? false
, name
, version
, ipkgName ? name
, extraBuildInputs ? []
, ...
}@attrs:
@@ -13,7 +14,10 @@ let
++ lib.optional (!noPrelude) idrisPackages.prelude
++ lib.optional (!noBase) idrisPackages.base;
idris-with-packages = idrisPackages.with-packages allIdrisDeps;
newAttrs = builtins.removeAttrs attrs [ "idrisDeps" "extraBuildInputs" "name" "version" ] // {
newAttrs = builtins.removeAttrs attrs [
"idrisDeps" "noPrelude" "noBase"
"name" "version" "ipkgName" "extraBuildInputs"
] // {
meta = attrs.meta // {
platforms = attrs.meta.platforms or idrisPackages.idris.meta.platforms;
};
@@ -29,22 +33,29 @@ stdenv.mkDerivation ({
# 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"
runHook prePatch
sed -i ${ipkgName}.ipkg -e "/^opts/ s|-i \\.\\./|-i ${idris-with-packages}/libs/|g"
'';
buildPhase = ''
idris --build *.ipkg
runHook preBuild
idris --build ${ipkgName}.ipkg
runHook postBuild
'';
checkPhase = ''
if grep -q test *.ipkg; then
idris --testpkg *.ipkg
runHook preCheck
if grep -q tests ${ipkgName}.ipkg; then
idris --testpkg ${ipkgName}.ipkg
fi
runHook postCheck
'';
installPhase = ''
idris --install *.ipkg --ibcsubdir $out/libs
IDRIS_DOC_PATH=$out/doc idris --installdoc *.ipkg || true
runHook preInstall
idris --install ${ipkgName}.ipkg --ibcsubdir $out/libs
IDRIS_DOC_PATH=$out/doc idris --installdoc ${ipkgName}.ipkg || true
runHook postInstall
'';
} // newAttrs)