mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-17 16:21:46 +03:00
96d914b93d
- DRY - idris2 is used as a compiler, should thus be in nativeBuildInputs
41 lines
836 B
Nix
41 lines
836 B
Nix
{ stdenv
|
|
, lib
|
|
, projectName
|
|
, src
|
|
, idris2
|
|
, idris2-version
|
|
, idrisLibraries
|
|
}:
|
|
|
|
let
|
|
ipkgName = projectName + ".ipkg";
|
|
idrName = "idris2-${idris2-version}";
|
|
libSuffix = "lib/${idrName}";
|
|
lib-dirs = lib.strings.concatMapStringsSep ":" (p: "${p}/${libSuffix}") idrisLibraries;
|
|
in
|
|
rec {
|
|
build = stdenv.mkDerivation {
|
|
name = projectName;
|
|
src = src;
|
|
nativeBuildInputs = [ idris2 ];
|
|
configurePhase = ''
|
|
export IDRIS2_PACKAGE_PATH=${lib-dirs}
|
|
'';
|
|
buildPhase = ''
|
|
idris2 --build ${ipkgName}
|
|
'';
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
mv build/exec/* $out/bin
|
|
'';
|
|
};
|
|
installLibrary = build.overrideAttrs (_: {
|
|
buildPhase = "";
|
|
installPhase = ''
|
|
mkdir -p $out/${libSuffix}
|
|
export IDRIS2_PREFIX=$out/lib
|
|
idris2 --install ${ipkgName}
|
|
'';
|
|
});
|
|
}
|