22 configurePhase ? null,
31 name = "interactive-shell-${drv.pname}";
32 buildInputs = [ drv ];
35 customPhases = lib.filterAttrs (_: v: v != null) {
44 # When using the `beamDeps` argument, it is important that we use
45 # `rebar3WithPlugins` here even when there are no plugins. The vanilla
46 # `rebar3` package is an escript archive with bundled dependencies which can
47 # interfere with those in the app we are trying to build. `rebar3WithPlugins`
48 # doesn't have this issue since it puts its own deps last on the code path.
49 rebar3 = rebar3WithPlugins {
50 plugins = buildPlugins;
54 assert beamDeps != [ ] -> checkouts == null;
60 name = "${pname}-${version}";
61 inherit version pname;
72 # ensure we strip any native binaries (eg. NIFs, ports)
73 stripDebugList = lib.optional (releaseType == "release") "rel";
77 REBAR_IGNORE_DEPS = beamDeps != [ ];
81 ${lib.optionalString (checkouts != null) "cp --no-preserve=all -R ${checkouts}/_checkouts ."}
87 HOME=. DEBUG=1 rebar3 as ${profile} ${if releaseType == "escript" then "escriptize" else "release"}
93 dir=${if releaseType == "escript" then "bin" else "rel"}
94 mkdir -p "$out/$dir" "$out/bin"
95 cp -R --preserve=mode "_build/${profile}/$dir" "$out"
96 ${lib.optionalString (
97 releaseType == "release"
98 ) "find $out/rel/*/bin -type f -executable -exec ln -s -t $out/bin {} \\;"}
102 # Release will generate a binary which will cause a read null byte failure, see #261354
103 postInstall = lib.optionalString (releaseType == "escript") ''
104 for dir in $out/rel/*/erts-*; do
105 echo "ERTS found in $dir - removing references to erlang to reduce closure size"
106 for f in $dir/bin/{erl,start}; do
107 substituteInPlace "$f" --replace "${erlang}/lib/erlang" "''${dir/\/erts-*/}"
113 inherit (erlang.meta) platforms;
121 // (if attrs ? passthru then attrs.passthru else { })