From 0458b14f481ddd626e03f7b1cd4be4344960fd29 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 4 Jun 2026 19:28:21 +0900 Subject: [PATCH] core-init-ext: add more checking and verbose errors to `checkPhase` --- src/core-init-ext.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core-init-ext.nix b/src/core-init-ext.nix index 49977e5..34f0d26 100644 --- a/src/core-init-ext.nix +++ b/src/core-init-ext.nix @@ -79,6 +79,18 @@ in stdenv.mkDerivation (finalAttrs: { checkPhase = '' runHook preCheck + for ext in ${lib.escapeShellArgs (builtins.catAttrs "library" extensions)}; do + if [ ! -f "$ext" ]; then + echo "Extension $ext does not exist." + exit 1 + fi + + if ! file "$ext" | grep -qE "ELF|ar archive"; then + echo "Extension $ext does not appear to be a valid shared library or static archive." + exit 1 + fi + done + for ext in ${lib.escapeShellArgs (builtins.catAttrs "library" extensions)}; do if nm -g --defined-only "$ext" | grep -q " sqlite_api$"; then echo "Extension $ext appears to reference the 'sqlite_api' symbol, which is not expected for extensions which are going to be statically linked." @@ -94,6 +106,8 @@ in stdenv.mkDerivation (finalAttrs: { for sym in "''${!expectedSymbols[@]}"; do if ! nm -g --defined-only "''${expectedSymbols[$sym]}" | grep -q " ''${sym}$"; then echo "Expected symbol $sym not found in ''${expectedSymbols[$sym]}." + echo "Found symbols:" + nm -g --defined-only "''${expectedSymbols[$sym]}" exit 1 fi done