nix: Move postgrest-check-static inside derivation of static package

This will make the static build fail if we're not producing a static binary.
This commit is contained in:
Wolfgang Walther
2024-01-26 23:24:12 +01:00
committed by Wolfgang Walther
parent 411cf430ad
commit c43696c9a6
3 changed files with 15 additions and 29 deletions
+15 -3
View File
@@ -46,9 +46,21 @@ let
});
});
makeExecutableStatic = drv:
lib.justStaticExecutables
(lib.appendConfigureFlag drv "--enable-executable-static");
makeExecutableStatic = drv: pkgs.lib.pipe drv [
(lib.compose.appendConfigureFlags [ "--enable-executable-static" ])
lib.compose.justStaticExecutables
(lib.compose.overrideCabal (drv: {
postInstall = ''
exe="$out/bin/postgrest"
if ! (file "$exe" | grep 'statically linked') then
echo "not a static executable, ldd output:"
ldd "$exe"
exit 1
fi
"$exe" --help
'';
}))
];
in
{