unixODBCDrivers.psql: merge with psqlodbc

The former hasn't been updated in years and broke with the upgrade of
`pkgs.postgresql` to v16 subsequently breaking `qtbase`[1].

There's already `pkgs.psqlodbc` which seems to be the same, but kept
up-to-date and linked against libiodbc. Modify `pkgs.psqlodbc` to
provide both libiodbc and unixodbc variants.

[1] https://github.com/NixOS/nixpkgs/pull/329611#issuecomment-2267513284
This commit is contained in:
Maximilian Bosch
2024-08-06 09:40:27 +02:00
parent ab783af38b
commit ae0d5d9cc8
2 changed files with 22 additions and 30 deletions
@@ -1,4 +1,9 @@
{ lib, stdenv, fetchurl, libiodbc, postgresql, openssl }:
{ lib, stdenv, fetchurl, postgresql, openssl
, withLibiodbc ? false, libiodbc
, withUnixODBC ? true, unixODBC
}:
assert lib.xor withLibiodbc withUnixODBC;
stdenv.mkDerivation rec {
pname = "psqlodbc";
@@ -9,18 +14,28 @@ stdenv.mkDerivation rec {
hash = "sha256-r9iS+J0uzujT87IxTxvVvy0CIBhyxuNDHlwxCW7KTIs=";
};
buildInputs = [ libiodbc postgresql openssl ];
buildInputs = [
postgresql
openssl
]
++ lib.optional withLibiodbc libiodbc
++ lib.optional withUnixODBC unixODBC;
passthru = lib.optionalAttrs withUnixODBC {
fancyName = "PostgreSQL";
driver = "lib/psqlodbcw.so";
};
configureFlags = [
"--with-iodbc=${libiodbc}"
"--with-libpq=${lib.getDev postgresql}/bin/pg_config"
];
]
++ lib.optional withLibiodbc "--with-iodbc=${libiodbc}";
meta = with lib; {
homepage = "https://odbc.postgresql.org/";
description = "ODBC driver for PostgreSQL";
license = licenses.lgpl2;
platforms = platforms.linux;
platforms = platforms.unix;
maintainers = [ ];
};
}
@@ -1,4 +1,4 @@
{ fetchurl, stdenv, unixODBC, cmake, postgresql, mariadb, sqlite, zlib, libxml2, dpkg, lib, openssl, libkrb5, libuuid, patchelf, libiconv, fixDarwinDylibNames, fetchFromGitHub }:
{ fetchurl, stdenv, unixODBC, cmake, mariadb, sqlite, zlib, libxml2, dpkg, lib, openssl, libkrb5, libuuid, patchelf, libiconv, fixDarwinDylibNames, fetchFromGitHub, psqlodbc }:
# Each of these ODBC drivers can be configured in your odbcinst.ini file using
# the various passthru and meta values. Of note are:
@@ -16,30 +16,7 @@
# ''
{
psql = stdenv.mkDerivation rec {
pname = "psqlodbc";
version = "10.01.0000";
src = fetchurl {
url = "mirror://postgresql/odbc/versions/src/${pname}-${version}.tar.gz";
sha256 = "1cyams7157f3gry86x64xrplqi2vyqrq3rqka59gv4lb4rpl7jl7";
};
buildInputs = [ unixODBC postgresql ];
# see the top of the file for an explanation
passthru = {
fancyName = "PostgreSQL";
driver = "lib/psqlodbcw.so";
};
meta = with lib; {
description = "Official PostgreSQL ODBC Driver";
homepage = "https://odbc.postgresql.org/";
license = licenses.lgpl2;
platforms = platforms.unix;
};
};
psql = psqlodbc.override { withUnixODBC = true; withLibiodbc = false; };
mariadb = stdenv.mkDerivation rec {
pname = "mariadb-connector-odbc";