summary refs log tree commit diff
path: root/pkgs/development/beam-modules/build-rebar3.nix
diff options
context:
space:
mode:
authorEric Sagnes <eric.sagnes@gmail.com>2017-02-18 22:25:24 +0900
committerJoachim F <joachifm@users.noreply.github.com>2017-02-18 14:25:24 +0100
commit979d20794d8651d7ac5c86ad37b68eacbadc5cc1 (patch)
tree4b5d6065f63add8997c80155f1508f304552807a /pkgs/development/beam-modules/build-rebar3.nix
parent8a6fa4a320e77e7f8ba92e61355131c6438ec2d6 (diff)
downloadnixpkgs-979d20794d8651d7ac5c86ad37b68eacbadc5cc1.tar
nixpkgs-979d20794d8651d7ac5c86ad37b68eacbadc5cc1.tar.gz
nixpkgs-979d20794d8651d7ac5c86ad37b68eacbadc5cc1.tar.bz2
nixpkgs-979d20794d8651d7ac5c86ad37b68eacbadc5cc1.tar.lz
nixpkgs-979d20794d8651d7ac5c86ad37b68eacbadc5cc1.tar.xz
nixpkgs-979d20794d8651d7ac5c86ad37b68eacbadc5cc1.tar.zst
nixpkgs-979d20794d8651d7ac5c86ad37b68eacbadc5cc1.zip
buildRebar3: fix buildPhase & cleanup (#22744)
Diffstat (limited to 'pkgs/development/beam-modules/build-rebar3.nix')
-rw-r--r--pkgs/development/beam-modules/build-rebar3.nix30
1 files changed, 13 insertions, 17 deletions
diff --git a/pkgs/development/beam-modules/build-rebar3.nix b/pkgs/development/beam-modules/build-rebar3.nix
index f783683cd4a..de2c6d40d40 100644
--- a/pkgs/development/beam-modules/build-rebar3.nix
+++ b/pkgs/development/beam-modules/build-rebar3.nix
@@ -26,6 +26,10 @@ let
           buildInputs = [ drv ];
     };
 
+  customPhases = filterAttrs
+    (_: v: v != null)
+    { inherit setupHook configurePhase buildPhase installPhase; };
+
   pkg = self: stdenv.mkDerivation (attrs // {
 
     name = "${name}-${version}";
@@ -41,37 +45,30 @@ let
 
     inherit src;
 
-    setupHook = if setupHook == null
-    then writeText "setupHook.sh" ''
+    setupHook = writeText "setupHook.sh" ''
        addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
-    ''
-    else setupHook;
+    '';
 
     postPatch = ''
       rm -f rebar rebar3
     '' + postPatch;
 
-    configurePhase = if configurePhase == null
-    then ''
+    configurePhase = ''
       runHook preConfigure
       ${erlang}/bin/escript ${rebar3.bootstrapper} ${debugInfoFlag}
       runHook postConfigure
-    ''
-    else configurePhase;
+    '';
 
-    buildPhase = if buildPhase == null
-    then ''
+    buildPhase = ''
       runHook preBuild
       HOME=. rebar3 compile
       ${if compilePorts then ''
         HOME=. rebar3 pc compile
       '' else ''''}
       runHook postBuild
-    ''
-    else installPhase;
+    '';
 
-    installPhase = if installPhase == null
-    then ''
+    installPhase = ''
       runHook preInstall
       mkdir -p "$out/lib/erlang/lib/${name}-${version}"
       for reldir in src ebin priv include; do
@@ -81,8 +78,7 @@ let
         success=1
       done
       runHook postInstall
-    ''
-    else installPhase;
+    '';
 
     meta = {
       inherit (erlang.meta) platforms;
@@ -93,6 +89,6 @@ let
       env = shell self;
       inherit beamDeps;
     };
-  });
+  } // customPhases);
 in
   fix pkg