@@ -1,4 +1,4 @@
1−{ stdenv, writeText, elixir, erlang, hexRegistrySnapshot, hex }:
1+{ stdenv, writeText, elixir, erlang, hexRegistrySnapshot, hex, lib }:
22
33{ name
44, version
@@ -8,12 +8,19 @@
88, beamDeps ? []
99, postPatch ? ""
1010, compilePorts ? false
11+, installPhase ? null
12+, buildPhase ? null
13+, configurePhase ? null
1114, meta ? {}
15+, enableDebugInfo ? false
1216, ... }@attrs:
1317
1418with stdenv.lib;
1519
1620let
21+
22+ debugInfoFlag = lib.optionalString (enableDebugInfo || elixir.debugInfo) "--debug-info";
23+
1724 shell = drv: stdenv.mkDerivation {
1825 name = "interactive-shell-${drv.name}";
1926 buildInputs = [ drv ];
@@ -38,25 +45,31 @@ let
3845 inherit buildInputs;
3946 propagatedBuildInputs = [ hexRegistrySnapshot hex elixir ] ++ beamDeps;
4047
41− configurePhase = ''
48+ configurePhase = if configurePhase == null
49+ then ''
4250 runHook preConfigure
4351 ${erlang}/bin/escript ${bootstrapper}
4452 runHook postConfigure
45− '';
53+ ''
54+ else configurePhase ;
4655
47− buildPhase = ''
56+
57+ buildPhase = if buildPhase == null
58+ then ''
4859 runHook preBuild
4960
5061 export HEX_OFFLINE=1
5162 export HEX_HOME=`pwd`
5263 export MIX_ENV=prod
5364
54− MIX_ENV=prod mix compile --debug-info --no-deps-check
65+ MIX_ENV=prod mix compile ${debugInfoFlag} --no-deps-check
5566
5667 runHook postBuild
57− '';
68+ ''
69+ else buildPhase;
5870
59− installPhase = ''
71+ installPhase = if installPhase == null
72+ then ''
6073 runHook preInstall
6174
6275 MIXENV=prod
@@ -74,7 +87,8 @@ let
7487 done
7588
7689 runHook postInstall
77− '';
90+ ''
91+ else installPhase;
7892
7993 passthru = {
8094 packageName = name;