2021-09-23 15:35:13 +00:00
|
|
|
{ lib, stdenv, nim, nim_builder }:
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
{ strictDeps ? true, depsBuildBuild ? [ ], nativeBuildInputs ? [ ]
|
|
|
|
, configurePhase ? null, buildPhase ? null, checkPhase ? null
|
2022-10-21 18:38:19 +00:00
|
|
|
, installPhase ? null, enableParallelBuilding ? true, meta ? { }, ... }@attrs:
|
2021-09-23 15:35:13 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation (attrs // {
|
2022-10-21 18:38:19 +00:00
|
|
|
inherit strictDeps enableParallelBuilding;
|
2022-06-16 17:23:12 +00:00
|
|
|
depsBuildBuild = [ nim_builder ] ++ depsBuildBuild;
|
|
|
|
nativeBuildInputs = [ nim ] ++ nativeBuildInputs;
|
2021-09-23 15:35:13 +00:00
|
|
|
|
|
|
|
configurePhase = if isNull configurePhase then ''
|
|
|
|
runHook preConfigure
|
2022-01-13 20:06:32 +00:00
|
|
|
export NIX_NIM_BUILD_INPUTS=''${pkgsHostTarget[@]} $NIX_NIM_BUILD_INPUTS
|
2021-09-23 15:35:13 +00:00
|
|
|
nim_builder --phase:configure
|
|
|
|
runHook postConfigure
|
|
|
|
'' else
|
2021-12-19 01:06:50 +00:00
|
|
|
configurePhase;
|
2021-09-23 15:35:13 +00:00
|
|
|
|
|
|
|
buildPhase = if isNull buildPhase then ''
|
|
|
|
runHook preBuild
|
|
|
|
nim_builder --phase:build
|
|
|
|
runHook postBuild
|
|
|
|
'' else
|
|
|
|
buildPhase;
|
|
|
|
|
|
|
|
checkPhase = if isNull checkPhase then ''
|
|
|
|
runHook preCheck
|
|
|
|
nim_builder --phase:check
|
|
|
|
runHook postCheck
|
|
|
|
'' else
|
|
|
|
checkPhase;
|
|
|
|
|
|
|
|
installPhase = if isNull installPhase then ''
|
|
|
|
runHook preInstall
|
|
|
|
nim_builder --phase:install
|
|
|
|
runHook postInstall
|
|
|
|
'' else
|
|
|
|
installPhase;
|
|
|
|
|
|
|
|
meta = meta // {
|
2022-02-20 05:27:41 +00:00
|
|
|
platforms = meta.platforms or nim.meta.platforms;
|
2021-09-23 15:35:13 +00:00
|
|
|
maintainers = (meta.maintainers or [ ]) ++ [ lib.maintainers.ehmry ];
|
|
|
|
};
|
|
|
|
})
|