buildMix: copy package.json to support phoenix builds

This commit is contained in:
Adam Stephens 2023-06-28 10:48:59 -04:00 committed by Yt
parent de3946feec
commit fcbfef1e43
2 changed files with 27 additions and 0 deletions

View File

@ -87,6 +87,12 @@ let
fi
done
# Copy the source so it can be used by dependent packages. For example,
# phoenix applications need the source of phoenix and phoenix_html to
# build javascript and css assets.
mkdir -p $out/src
cp -r $src/* "$out/src"
runHook postInstall
'';

View File

@ -81,6 +81,27 @@ stdenv.mkDerivation (overridable // {
# Phoenix projects for example will need compile.phoenix
mix deps.compile --no-deps-check --skip-umbrella-children
# Symlink dependency sources. This is needed for projects that require
# access to the source of their dependencies. For example, Phoenix
# applications need javascript assets to build asset bundles.
${lib.optionalString (mixNixDeps != { }) ''
mkdir -p deps
${lib.concatMapStringsSep "\n" (dep: ''
dep_name=$(basename ${dep} | cut -d '-' -f2)
dep_path="deps/$dep_name"
if [ -d "${dep}/src" ]; then
ln -s ${dep}/src $dep_path
fi
'') (builtins.attrValues mixNixDeps)}
''}
# Symlink deps to build root. Similar to above, but allows for mixFodDeps
# Phoenix projects to find javascript assets.
${lib.optionalString (mixFodDeps != null) ''
ln -s ../deps ./
''}
runHook postConfigure
'';