nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

mix-release: remove erlang ref in erts dir

+11 -11
+11 -11
pkgs/development/beam-modules/mix-release.nix
··· 93 93 if [ -e $out/releases/COOKIE ]; then # absent in special cases, i.e. elixir-ls 94 94 rm $out/releases/COOKIE 95 95 fi 96 - # TODO remove the uneeded reference too erlang 97 - # one possible way would be 98 - # for f in $(${findutils}/bin/find $out -name start); do 99 - # substituteInPlace $f \ 100 - # --replace 'ROOTDIR=${erlang}/lib/erlang' 'ROOTDIR=""' 101 - # done 102 - # What is left to do is to check that erlang is not required on 103 - # the host 96 + # removing unused erlang reference from resulting derivation to reduce 97 + # closure size 98 + if [ -e $out/erts-* ]; then 99 + echo "ERTS found in $dir - removing references to erlang to reduce closure size" 100 + for file in $out/erts-*/bin/{erl,start}; do 101 + substituteInPlace "$file" --replace "${erlang}/lib/erlang" "$out" 102 + done 103 + fi 104 104 105 105 patchShebangs $out 106 106 runHook postFixup 107 107 ''; 108 - # TODO figure out how to do a Fixed Output Derivation and add the output hash 109 - # This doesn't play well at the moment with Phoenix projects 110 - # for example that have frontend dependencies 111 108 109 + # TODO investigate why the resulting closure still has 110 + # a reference to erlang. 111 + # uncommenting the following will fail the build 112 112 # disallowedReferences = [ erlang ]; 113 113 })