nix: remove libpq overlay
We have fixed the static build of PostgreSQL upstream, so we don't need our separate overlay anymore. One more step towards building a static executable on other platforms.
This commit is contained in:
@@ -43,7 +43,6 @@ let
|
|||||||
allOverlays.build-toolbox
|
allOverlays.build-toolbox
|
||||||
allOverlays.checked-shell-script
|
allOverlays.checked-shell-script
|
||||||
allOverlays.gitignore
|
allOverlays.gitignore
|
||||||
allOverlays.postgresql-libpq
|
|
||||||
(allOverlays.haskell-packages { inherit compiler; })
|
(allOverlays.haskell-packages { inherit compiler; })
|
||||||
allOverlays.slocat
|
allOverlays.slocat
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
# 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
|
|
||||||
, postgresql
|
|
||||||
, pkg-config
|
|
||||||
, tzdata
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "libpq";
|
|
||||||
inherit (postgresql) src version patches;
|
|
||||||
|
|
||||||
__structuredAttrs = true;
|
|
||||||
env.CFLAGS = "-fdata-sections -ffunction-sections"
|
|
||||||
+ (if stdenv.cc.isClang then " -flto" else " -fmerge-constants -Wl,--gc-sections");
|
|
||||||
|
|
||||||
configureFlags = [
|
|
||||||
"--without-gssapi"
|
|
||||||
"--without-icu"
|
|
||||||
"--without-readline"
|
|
||||||
"--with-openssl"
|
|
||||||
"--with-system-tzdata=${tzdata}/share/zoneinfo"
|
|
||||||
"--sysconfdir=/etc/postgresql"
|
|
||||||
];
|
|
||||||
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,5 @@
|
|||||||
checked-shell-script = import ./checked-shell-script;
|
checked-shell-script = import ./checked-shell-script;
|
||||||
gitignore = import ./gitignore.nix;
|
gitignore = import ./gitignore.nix;
|
||||||
haskell-packages = import ./haskell-packages.nix;
|
haskell-packages = import ./haskell-packages.nix;
|
||||||
postgresql-libpq = import ./postgresql-libpq.nix;
|
|
||||||
slocat = import ./slocat.nix;
|
slocat = import ./slocat.nix;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
_: super:
|
|
||||||
{
|
|
||||||
# Depending on which nixpkgs version is pinned, libpq might either be available already - or not.
|
|
||||||
libpq = super.libpq or (super.callPackage ../libpq.nix {
|
|
||||||
postgresql = super.postgresql_16;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -18,23 +18,6 @@ let
|
|||||||
# Cross compiling with native bignum works better than with gmp
|
# Cross compiling with native bignum works better than with gmp
|
||||||
enableNativeBignum = true;
|
enableNativeBignum = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
overrides = pkgs.lib.composeExtensions old.overrides (_: prev: {
|
|
||||||
postgresql-libpq = (lib.overrideCabal prev.postgresql-libpq {
|
|
||||||
# TODO: This section can be simplified when this PR has made it's way to us:
|
|
||||||
# https://github.com/NixOS/nixpkgs/pull/286370
|
|
||||||
# Additionally, we need to use the default version in nixpkgs, otherwise the
|
|
||||||
# override will not be active as well.
|
|
||||||
# Using use-pkg-config flag, because pg_config won't work when cross-compiling
|
|
||||||
configureFlags = [ "-fuse-pkg-config" ];
|
|
||||||
# postgresql doesn't build in the fully static overlay - but the default
|
|
||||||
# derivation is built with static libraries anyway.
|
|
||||||
libraryPkgconfigDepends = [ pkgsStatic.libpq ];
|
|
||||||
librarySystemDepends = [ ];
|
|
||||||
}).overrideAttrs (_: prevAttrs: {
|
|
||||||
buildInputs = prevAttrs.buildInputs ++ [ pkgsStatic.openssl ];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
makeExecutableStatic = drv: pkgs.lib.pipe drv [
|
makeExecutableStatic = drv: pkgs.lib.pipe drv [
|
||||||
|
|||||||
Reference in New Issue
Block a user