nix: Build only libpq instead of full postgresql package

This commit is contained in:
Wolfgang Walther
2024-01-26 17:17:05 +01:00
committed by Wolfgang Walther
parent 259d97acee
commit 85fbb233a7
7 changed files with 74 additions and 26 deletions
+3 -16
View File
@@ -12,21 +12,6 @@ let
inherit (pkgsCross) pkgsStatic;
inherit (pkgsStatic.haskell) lib;
# postgresql doesn't build in the fully static overlay - but the default
# derivation is built with static libraries anyway.
libpq = (pkgsCross.postgresql.override {
# disable server-side only stuff to improve compilation times
enableSystemd = false;
jitSupport = false;
# disable gssapi support, because it leads to linking errors
gssSupport = false;
}).overrideAttrs (finalAttrs: prevAttrs: {
dontDisableStatic = true;
# Tests fail for initdb and other server-side code which we don't care about
doCheck = false;
});
packagesStatic =
pkgsStatic.haskell.packages."${compiler}".override (old: {
ghc = pkgsStatic.pkgsBuildHost.haskell.compiler."${compiler}".override {
@@ -40,7 +25,9 @@ let
overrides = pkgs.lib.composeExtensions old.overrides (final: prev: {
postgresql-libpq = (prev.postgresql-libpq.override {
postgresql = libpq;
# postgresql doesn't build in the fully static overlay - but the default
# derivation is built with static libraries anyway.
postgresql = pkgsCross.libpq;
}).overrideAttrs (finalAttrs: prevAttrs: {
# Using use-pkg-config flag, because pg_config won't work when cross-compiling
configureFlags = prevAttrs.configureFlags ++ [ "-fuse-pkg-config" ];