diff --git a/pkgs/development/libraries/psqlodbc/default.nix b/pkgs/development/libraries/psqlodbc/default.nix index 946cb5035935..0431bb284dab 100644 --- a/pkgs/development/libraries/psqlodbc/default.nix +++ b/pkgs/development/libraries/psqlodbc/default.nix @@ -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 = [ ]; }; } diff --git a/pkgs/development/libraries/unixODBCDrivers/default.nix b/pkgs/development/libraries/unixODBCDrivers/default.nix index 641d051c1c32..fe181d37f6bf 100644 --- a/pkgs/development/libraries/unixODBCDrivers/default.nix +++ b/pkgs/development/libraries/unixODBCDrivers/default.nix @@ -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";