beamPackages.mixRelease: extract mixDepsCompileHook

This commit is contained in:
Adam C. Stephens
2026-09-14 23:07:39 -04:00
parent 16f22d7599
commit 2ff9ee32fb
4 changed files with 25 additions and 14 deletions

View File

@@ -85,6 +85,7 @@ makeScopeWithSplicing' {
mixAppConfigPatchHook
mixBuildDirHook
mixCompileHook
mixDepsCompileHook
mixEscriptSetupHook
mixFodDepsSetupHook
mixNixDepsSetupHook

View File

@@ -28,6 +28,11 @@
meta.license = lib.licenses.mit;
} ./mix-compile-hook.sh;
mixDepsCompileHook = makeSetupHook {
name = "mix-deps-compile-hook.sh";
meta.license = lib.licenses.mit;
} ./mix-deps-compile-hook.sh;
mixEscriptSetupHook = makeSetupHook {
name = "mix-escript-setup-hook.sh";
meta.license = lib.licenses.mit;

View File

@@ -0,0 +1,17 @@
# shellcheck shell=bash
#
# This is needed for projects that have a specific compile step
# the dependency needs to be compiled in order for the task
# to be available.
#
# Phoenix projects for example will need compile.phoenix.
mixDepsCompileHook() {
echo "Executing mixDepsCompileHook"
mix deps.compile --no-deps-check --skip-umbrella-children
echo "Finished mixDepsCompileHook"
}
postConfigureHooks+=(mixDepsCompileHook)

View File

@@ -19,6 +19,7 @@
gawk,
mixBuildDirHook,
mixCompileHook,
mixDepsCompileHook,
mixEscriptSetupHook,
mixFodDepsSetupHook,
mixNixDepsSetupHook,
@@ -122,6 +123,7 @@ lib.extendMkDerivation {
mixBuildDirHook
mixCompileHook
mixDepsCompileHook
]
++ lib.optionals (escriptBinName != null) [ mixEscriptSetupHook ]
++ lib.optionals (escriptBinName == null) [ mixReleaseSetupHook ]
@@ -165,20 +167,6 @@ lib.extendMkDerivation {
}
// (attrs.env or { });
configurePhase =
attrs.configurePhase or ''
runHook preConfigure
# This is needed for projects that have a specific compile step
# the dependency needs to be compiled in order for the task
# to be available.
#
# Phoenix projects for example will need compile.phoenix.
mix deps.compile --no-deps-check --skip-umbrella-children
runHook postConfigure
'';
postFixup = ''
echo "removing files for Microsoft Windows"
rm -f "$out"/bin/*.bat