1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-28 08:31:59 +00:00

mix-release: remove erlang ref in resulting derivation

This commit is contained in:
happysalada 2021-06-06 19:58:21 +09:00 committed by Raphael Megzari
parent 2a87cb7a8b
commit 5e9f18c572

View file

@ -1,4 +1,4 @@
{ stdenv, lib, elixir, erlang, findutils, hex, rebar3, fetchMixDeps, makeWrapper, git }:
{ stdenv, lib, elixir, erlang, findutils, hex, rebar3, fetchMixDeps, makeWrapper, git, ripgrep }:
{ pname
, version
@ -23,7 +23,8 @@ let
in
assert mixNixDeps != { } -> mixFodDeps == null;
stdenv.mkDerivation (overridable // {
nativeBuildInputs = nativeBuildInputs ++ [ erlang hex elixir makeWrapper git ];
# rg is used as a better grep to search for erlang references in the final release
nativeBuildInputs = nativeBuildInputs ++ [ erlang hex elixir makeWrapper git ripgrep ];
buildInputs = builtins.attrValues mixNixDeps;
MIX_ENV = mixEnv;
@ -96,8 +97,8 @@ stdenv.mkDerivation (overridable // {
# removing unused erlang reference from resulting derivation to reduce
# closure size
if [ -e $out/erts-* ]; then
echo "ERTS found in $dir - removing references to erlang to reduce closure size"
for file in $out/erts-*/bin/{erl,start}; do
echo "ERTS found in $out - removing references to erlang to reduce closure size"
for file in $(rg "${erlang}/lib/erlang" "$out" --text --files-with-matches); do
substituteInPlace "$file" --replace "${erlang}/lib/erlang" "$out"
done
fi