nix: Build only libpq instead of full postgresql package
This commit is contained in:
committed by
Wolfgang Walther
parent
259d97acee
commit
85fbb233a7
+1
-1
@@ -36,7 +36,7 @@ let
|
||||
allOverlays.build-toolbox
|
||||
allOverlays.checked-shell-script
|
||||
allOverlays.gitignore
|
||||
allOverlays.postgresql-default
|
||||
allOverlays.postgresql-libpq
|
||||
allOverlays.postgresql-legacy
|
||||
allOverlays.postgresql-future
|
||||
allOverlays.postgis
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# Creating a separate libpq package is is discussed in
|
||||
# https://github.com/NixOS/nixpkgs/issues/61580, but nixpkgs has not moved
|
||||
# forward, yet.
|
||||
# This package is passed to postgresql-libpq (haskell) which needs to be
|
||||
# cross-compiled to the static build and possibly other architectures as
|
||||
# as well. To reduce the number of dependencies that need to be built with
|
||||
# it, this derivation focuses on building the client libraries only. No
|
||||
# server, no tests.
|
||||
{ stdenv
|
||||
, lib
|
||||
, openssl
|
||||
, zlib
|
||||
, libkrb5
|
||||
, icu
|
||||
, postgresql
|
||||
, pkg-config
|
||||
, tzdata
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "libpq";
|
||||
inherit (postgresql) src version;
|
||||
|
||||
configureFlags = [
|
||||
"--without-gssapi"
|
||||
"--without-readline"
|
||||
"--with-openssl"
|
||||
"--with-system-tzdata=${tzdata}/share/zoneinfo"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config tzdata ];
|
||||
buildInputs = [ openssl zlib ];
|
||||
|
||||
buildFlags = [ "submake-libpq" "submake-libpgport" ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
make -C src/bin/pg_config install
|
||||
make -C src/common install
|
||||
make -C src/include install
|
||||
make -C src/interfaces/libpq install
|
||||
make -C src/port install
|
||||
|
||||
rm -rfv $out/share
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
outputs = [ "out" ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.postgresql.org";
|
||||
description = "Client API library for PostgreSQL";
|
||||
license = licenses.postgresql;
|
||||
};
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
gitignore = import ./gitignore.nix;
|
||||
haskell-packages = import ./haskell-packages.nix;
|
||||
postgis = import ./postgis.nix;
|
||||
postgresql-default = import ./postgresql-default.nix;
|
||||
postgresql-libpq = import ./postgresql-libpq.nix;
|
||||
postgresql-legacy = import ./postgresql-legacy.nix;
|
||||
postgresql-future = import ./postgresql-future.nix;
|
||||
slocat = import ./slocat.nix;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ compiler, extraOverrides ? (final: prev: { }) }:
|
||||
{ compiler }:
|
||||
|
||||
self: super:
|
||||
let
|
||||
@@ -41,11 +41,14 @@ let
|
||||
# Marked as broken (?)
|
||||
fuzzyset = lib.markUnbroken prev.fuzzyset;
|
||||
|
||||
postgresql-libpq = lib.dontCheck prev.postgresql-libpq_0_10_0_0;
|
||||
postgresql-libpq = lib.dontCheck
|
||||
(prev.postgresql-libpq_0_10_0_0.override {
|
||||
postgresql = super.libpq;
|
||||
});
|
||||
|
||||
hasql-pool = lib.dontCheck prev.hasql-pool_0_10;
|
||||
|
||||
} // extraOverrides final prev;
|
||||
};
|
||||
in
|
||||
{
|
||||
haskell =
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
self: super:
|
||||
# Overlay that sets the default version of PostgreSQL.
|
||||
{
|
||||
postgresql = super.postgresql_15;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
self: super:
|
||||
{
|
||||
libpq = super.callPackage ../libpq.nix {
|
||||
postgresql = super.postgresql_15;
|
||||
};
|
||||
}
|
||||
+3
-16
@@ -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" ];
|
||||
|
||||
Reference in New Issue
Block a user