mix: add build mix and mix-release configure-hook
This commit is contained in:
parent
fc2518d7d2
commit
b1b78ac65d
|
@ -42,6 +42,14 @@ let
|
||||||
nativeBuildInputs = nativeBuildInputs ++ [ elixir hex ];
|
nativeBuildInputs = nativeBuildInputs ++ [ elixir hex ];
|
||||||
propagatedBuildInputs = propagatedBuildInputs ++ beamDeps;
|
propagatedBuildInputs = propagatedBuildInputs ++ beamDeps;
|
||||||
|
|
||||||
|
configurePhase = attrs.configurePhase or ''
|
||||||
|
runHook preConfigure
|
||||||
|
|
||||||
|
${./mix-configure-hook.sh}
|
||||||
|
|
||||||
|
runHook postConfigure
|
||||||
|
'';
|
||||||
|
|
||||||
buildPhase = attrs.buildPhase or ''
|
buildPhase = attrs.buildPhase or ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
export HEX_HOME="$TEMPDIR/hex"
|
export HEX_HOME="$TEMPDIR/hex"
|
||||||
|
@ -83,3 +91,4 @@ let
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
fix pkg
|
fix pkg
|
||||||
|
|
||||||
|
|
18
pkgs/development/beam-modules/mix-configure-hook.sh
Executable file
18
pkgs/development/beam-modules/mix-configure-hook.sh
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# this hook will symlink all dependencies found in ERL_LIBS
|
||||||
|
# since Elixir 1.12.2 elixir does not look into ERL_LIBS for
|
||||||
|
# elixir depencencies anymore, so those have to be symlinked to the _build directory
|
||||||
|
mkdir -p _build/"$MIX_ENV"/lib
|
||||||
|
while read -r -d ':' lib; do
|
||||||
|
for dir in "$lib"/*; do
|
||||||
|
# Strip version number for directory name if it exists, so naming of
|
||||||
|
# all libs matches what mix's expectation.
|
||||||
|
dest=$(basename "$dir" | cut -d '-' -f1)
|
||||||
|
build_dir="_build/$MIX_ENV/lib/$dest"
|
||||||
|
((MIX_DEBUG == 1)) && echo "Linking $dir to $build_dir"
|
||||||
|
# Symlink libs to _build so that mix can find them when compiling.
|
||||||
|
# This is what allows mix to compile the package without searching
|
||||||
|
# for dependencies over the network.
|
||||||
|
ln -s "$dir" "$build_dir"
|
||||||
|
done
|
||||||
|
done <<< "$ERL_LIBS:"
|
|
@ -58,20 +58,7 @@ stdenv.mkDerivation (overridable // {
|
||||||
configurePhase = attrs.configurePhase or ''
|
configurePhase = attrs.configurePhase or ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
mkdir -p _build/$MIX_ENV/lib
|
${./mix-configure-hook.sh}
|
||||||
while read -d ':' lib; do
|
|
||||||
for dir in $lib/*; do
|
|
||||||
# Strip version number for directory name if it exists, so naming of
|
|
||||||
# all libs matches what mix's expectation.
|
|
||||||
dest=$(basename $dir | cut -d '-' -f1)
|
|
||||||
echo "Linking $dir to _build/$MIX_ENV/lib/$dest"
|
|
||||||
# Symlink libs to _build so that mix can find them when compiling.
|
|
||||||
# This is what allows mix to compile the package without searching
|
|
||||||
# for dependencies over the network.
|
|
||||||
ln -s $dir _build/$MIX_ENV/lib/$dest
|
|
||||||
done
|
|
||||||
done <<< "$ERL_LIBS:"
|
|
||||||
|
|
||||||
# this is needed for projects that have a specific compile step
|
# this is needed for projects that have a specific compile step
|
||||||
# the dependency needs to be compiled in order for the task
|
# the dependency needs to be compiled in order for the task
|
||||||
# to be available
|
# to be available
|
||||||
|
|
Loading…
Reference in a new issue