mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-21 10:41:59 +03:00
6780874d2e
so that one can pass attributes directly to buildIdris instead of the convoluted. buildIdris (...).build.overrideAttrs(oldAttrs: {})
51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{ stdenv
|
|
, lib
|
|
, idris2-version
|
|
, idris2
|
|
}:
|
|
{
|
|
src
|
|
, projectName
|
|
, idrisLibraries
|
|
, ...
|
|
}@attrs:
|
|
|
|
let
|
|
ipkgName = projectName + ".ipkg";
|
|
idrName = "idris2-${idris2-version}";
|
|
libSuffix = "lib/${idrName}";
|
|
lib-dirs = lib.strings.concatMapStringsSep ":" (p: "${p}/${libSuffix}") idrisLibraries;
|
|
drvAttrs = builtins.removeAttrs attrs [ "idrisLibraries" ];
|
|
in
|
|
rec {
|
|
build = stdenv.mkDerivation (drvAttrs // {
|
|
name = projectName;
|
|
src = src;
|
|
nativeBuildInputs = [ idris2 ];
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
export IDRIS2_PACKAGE_PATH=${lib-dirs}
|
|
runHook postConfigure
|
|
'';
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
idris2 --build ${ipkgName}
|
|
runHook postBuild
|
|
'';
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/bin
|
|
mv build/exec/* $out/bin
|
|
runHook postInstall
|
|
'';
|
|
});
|
|
installLibrary = build.overrideAttrs (_: {
|
|
buildPhase = "";
|
|
installPhase = ''
|
|
mkdir -p $out/${libSuffix}
|
|
export IDRIS2_PREFIX=$out/lib
|
|
idris2 --install ${ipkgName}
|
|
'';
|
|
});
|
|
}
|