guileImportsCheckHook: init

This hook should function similar to how pythonImportsCheck functions in
buildPythonApplication or buildPythonPackage.

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
This commit is contained in:
Ethan Carter Edwards
2025-06-08 18:37:55 -04:00
parent b764615d41
commit abecc61150
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# shellcheck shell=bash
# Setup hook for checking whether Guile imports succeed
echo "Sourcing guileImportsCheckHook.sh"
guileImportsCheckHook () {
echo "Executing guileImportsCheckHook"
if [[ -n "${guileImportsCheck[*]-}" ]]; then
echo "Check whether the following modules can be imported: ${guileImportsCheck[*]}"
for i in "${guileImportsCheck[@]}"
do
# prevent guile from trying to AOT compile during import
# guile can't find the library to import unless we set this
GUILE_LOAD_PATH="$out/share/guile/site/@effectiveVersion@" GUILE_AUTO_COMPILE=0 guile -c "(use-modules (${i}))"
done
fi
}
appendToVar preDistPhases guileImportsCheckHook

View File

@@ -0,0 +1,17 @@
{
lib,
makeSetupHook,
guile,
effectiveVersion ? guile.effectiveVersion,
}:
makeSetupHook {
name = "guileImportsCheckHook";
substitutions = {
effectiveVersion = guile.effectiveVersion;
};
meta = {
description = "Import Guile libraries";
maintainers = with lib.maintainers; [ ethancedwards8 ];
};
} ./guileImportsCheckHook.sh