9c6ee729d6
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
45 lines
1.2 KiB
Nix
45 lines
1.2 KiB
Nix
{ lib, stdenv, nim, nim_builder }:
|
|
pkgArgs:
|
|
|
|
let
|
|
baseAttrs = {
|
|
strictDeps = true;
|
|
enableParallelBuilding = true;
|
|
doCheck = true;
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
export NIX_NIM_BUILD_INPUTS=''${pkgsHostTarget[@]} $NIX_NIM_BUILD_INPUTS
|
|
nim_builder --phase:configure
|
|
runHook postConfigure
|
|
'';
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
nim_builder --phase:build
|
|
runHook postBuild
|
|
'';
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
nim_builder --phase:check
|
|
runHook postCheck
|
|
'';
|
|
installPhase = ''
|
|
runHook preInstall
|
|
nim_builder --phase:install
|
|
runHook postInstall
|
|
'';
|
|
meta = { inherit (nim.meta) maintainers platforms; };
|
|
};
|
|
|
|
inputsOverride =
|
|
{ depsBuildBuild ? [ ], nativeBuildInputs ? [ ], ... }: {
|
|
depsBuildBuild = [ nim_builder ] ++ depsBuildBuild;
|
|
nativeBuildInputs = [ nim ] ++ nativeBuildInputs;
|
|
};
|
|
|
|
composition = finalAttrs:
|
|
let
|
|
asFunc = x: if builtins.isFunction x then x else (_: x);
|
|
prev = baseAttrs // (asFunc ((asFunc pkgArgs) finalAttrs)) baseAttrs;
|
|
in prev // inputsOverride prev;
|
|
|
|
in stdenv.mkDerivation composition
|