build-idris-package: ipkgName
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user