diff --git a/pkgs/by-name/gu/guileImportsCheckHook/guileImportsCheckHook.sh b/pkgs/by-name/gu/guileImportsCheckHook/guileImportsCheckHook.sh new file mode 100644 index 000000000000..9600b28e4888 --- /dev/null +++ b/pkgs/by-name/gu/guileImportsCheckHook/guileImportsCheckHook.sh @@ -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 diff --git a/pkgs/by-name/gu/guileImportsCheckHook/package.nix b/pkgs/by-name/gu/guileImportsCheckHook/package.nix new file mode 100644 index 000000000000..7257bad1bec3 --- /dev/null +++ b/pkgs/by-name/gu/guileImportsCheckHook/package.nix @@ -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