From 2e61bd72a161d2f739049d407d6f8d8e0f933f92 Mon Sep 17 00:00:00 2001 From: Eric Merritt Date: Wed, 15 Jun 2016 07:19:44 -0700 Subject: beamPackages: add the ability to override phases --- pkgs/development/beam-modules/build-erlang-mk.nix | 20 ++++++++++++++------ pkgs/development/beam-modules/build-mix.nix | 22 ++++++++++++++++------ pkgs/development/beam-modules/build-rebar3.nix | 14 ++++++++++---- 3 files changed, 40 insertions(+), 16 deletions(-) (limited to 'pkgs/development') diff --git a/pkgs/development/beam-modules/build-erlang-mk.nix b/pkgs/development/beam-modules/build-erlang-mk.nix index 8c2b72aa43cf..ef966ebd04f7 100644 --- a/pkgs/development/beam-modules/build-erlang-mk.nix +++ b/pkgs/development/beam-modules/build-erlang-mk.nix @@ -8,6 +8,8 @@ , postPatch ? "" , compilePorts ? false , installPhase ? null +, buildPhase ? null +, configurePhase ? null , meta ? {} , ... }@attrs: @@ -37,7 +39,8 @@ let buildInputs = [ erlang perl which gitMinimal wget ]; propagatedBuildInputs = beamDeps; - configurePhase = '' + configurePhase = if configurePhase == null + then '' runHook preConfigure # We shouldnt need to do this, but it seems at times there is a *.app in @@ -45,17 +48,21 @@ let make SKIP_DEPS=1 clean runHook postConfigure - ''; + '' + else configurePhase; - buildPhase = '' + buildPhase = if buildPhase == null + then '' runHook preBuild make SKIP_DEPS=1 runHook postBuild - ''; + '' + else buildPhase; - installPhase = '' + installPhase = if installPhase == null + then '' runHook preInstall mkdir -p $out/lib/erlang/lib/${name} @@ -75,7 +82,8 @@ let fi runHook postInstall - ''; + '' + else installPhase; passthru = { packageName = name; diff --git a/pkgs/development/beam-modules/build-mix.nix b/pkgs/development/beam-modules/build-mix.nix index 70c186df8a06..3af7ff6f92c7 100644 --- a/pkgs/development/beam-modules/build-mix.nix +++ b/pkgs/development/beam-modules/build-mix.nix @@ -8,6 +8,9 @@ , beamDeps ? [] , postPatch ? "" , compilePorts ? false +, installPhase ? null +, buildPhase ? null +, configurePhase ? null , meta ? {} , ... }@attrs: @@ -38,13 +41,17 @@ let inherit buildInputs; propagatedBuildInputs = [ hexRegistrySnapshot hex elixir ] ++ beamDeps; - configurePhase = '' + configurePhase = if configurePhase == null + then '' runHook preConfigure ${erlang}/bin/escript ${bootstrapper} runHook postConfigure - ''; + '' + else configurePhase ; + - buildPhase = '' + buildPhase = if buildPhase == null + then '' runHook preBuild export HEX_OFFLINE=1 @@ -54,9 +61,11 @@ let MIX_ENV=prod mix compile --debug-info --no-deps-check runHook postBuild - ''; + '' + else buildPhase; - installPhase = '' + installPhase = if installPhase == null + then '' runHook preInstall MIXENV=prod @@ -74,7 +83,8 @@ let done runHook postInstall - ''; + '' + else installPhase; passthru = { packageName = name; diff --git a/pkgs/development/beam-modules/build-rebar3.nix b/pkgs/development/beam-modules/build-rebar3.nix index f13322519fd8..abf2d1188ddc 100644 --- a/pkgs/development/beam-modules/build-rebar3.nix +++ b/pkgs/development/beam-modules/build-rebar3.nix @@ -8,6 +8,8 @@ , postPatch ? "" , compilePorts ? false , installPhase ? null +, buildPhase ? null +, configurePhase ? null , meta ? {} , ... }@attrs: @@ -46,20 +48,24 @@ let rm -f rebar rebar3 ''; - configurePhase = '' + configurePhase = if configurePhase == null + then '' runHook preConfigure ${erlang}/bin/escript ${rebar3.bootstrapper} runHook postConfigure - ''; + '' + else configurePhase; - buildPhase = '' + buildPhase = if buildPhase == null + then '' runHook preBuild HOME=. rebar3 compile ${if compilePorts then '' HOME=. rebar3 pc compile '' else ''''} runHook postBuild - ''; + '' + else installPhase; installPhase = if installPhase == null then '' -- cgit 1.4.1