depot/third_party/nixpkgs/pkgs/development/nim-packages/build-nim-package/default.nix
Default email c594a97518 Project import generated by Copybara.
GitOrigin-RevId: 301aada7a64812853f2e2634a530ef5d34505048
2022-10-21 20:38:19 +02:00

45 lines
1.2 KiB
Nix

{ lib, stdenv, nim, nim_builder }:
{ strictDeps ? true, depsBuildBuild ? [ ], nativeBuildInputs ? [ ]
, configurePhase ? null, buildPhase ? null, checkPhase ? null
, installPhase ? null, enableParallelBuilding ? true, meta ? { }, ... }@attrs:
stdenv.mkDerivation (attrs // {
inherit strictDeps enableParallelBuilding;
depsBuildBuild = [ nim_builder ] ++ depsBuildBuild;
nativeBuildInputs = [ nim ] ++ nativeBuildInputs;
configurePhase = if isNull configurePhase then ''
runHook preConfigure
export NIX_NIM_BUILD_INPUTS=''${pkgsHostTarget[@]} $NIX_NIM_BUILD_INPUTS
nim_builder --phase:configure
runHook postConfigure
'' else
configurePhase;
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 // {
platforms = meta.platforms or nim.meta.platforms;
maintainers = (meta.maintainers or [ ]) ++ [ lib.maintainers.ehmry ];
};
})