mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
commit
700e2952be
3 changed files with 140 additions and 112 deletions
|
@ -5,14 +5,21 @@ with lib;
|
|||
# unixODBC drivers (this solution is not perfect.. Because the user has to
|
||||
# ask the admin to add a driver.. but it's simple and works
|
||||
|
||||
{
|
||||
let
|
||||
iniDescription = pkg: ''
|
||||
[${pkg.fancyName}]
|
||||
Description = ${pkg.meta.description}
|
||||
Driver = ${pkg}/${pkg.driver}
|
||||
'';
|
||||
|
||||
in {
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
environment.unixODBCDrivers = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
example = literalExample "with pkgs.unixODBCDrivers; [ mysql psql psqlng ]";
|
||||
example = literalExample "with pkgs.unixODBCDrivers; [ sqlite psql ]";
|
||||
description = ''
|
||||
Specifies Unix ODBC drivers to be registered in
|
||||
<filename>/etc/odbcinst.ini</filename>. You may also want to
|
||||
|
@ -25,11 +32,7 @@ with lib;
|
|||
###### implementation
|
||||
|
||||
config = mkIf (config.environment.unixODBCDrivers != []) {
|
||||
|
||||
environment.etc."odbcinst.ini".text =
|
||||
let inis = map (x : x.ini) config.environment.unixODBCDrivers;
|
||||
in lib.concatStringsSep "\n" inis;
|
||||
|
||||
environment.etc."odbcinst.ini".text = concatMapStringsSep "\n" iniDescription config.environment.unixODBCDrivers;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
{stdenv, fetchurl}:
|
||||
{ stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "unixODBC-2.3.2";
|
||||
name = "unixODBC-${version}";
|
||||
version = "2.3.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = "ftp://ftp.unixodbc.org/pub/unixODBC/${name}.tar.gz";
|
||||
sha256 = "16jw5fq7wgfky6ak1h2j2pqx99jivsdl4q8aq6immpr55xs5jd4w";
|
||||
sha256 = "0f8y88rcc2akjvjv5y66yx7k0ms9h1s0vbcfy25j93didflhj59f";
|
||||
};
|
||||
|
||||
configureFlags = [ "--disable-gui" "--sysconfdir=/etc" ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "ODBC driver manager for Unix";
|
||||
homepage = http://www.unixodbc.org/;
|
||||
license = licenses.lgpl2;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
configureFlags = "--disable-gui --sysconfdir=/etc";
|
||||
}
|
||||
|
|
|
@ -1,115 +1,130 @@
|
|||
{fetchurl, stdenv, unixODBC, glibc, libtool, openssl, zlib, postgresql, mysql, sqlite}:
|
||||
# each attr contains the name deriv referencing the derivation and ini which
|
||||
# evaluates to a string which can be appended to the global unix odbc ini file
|
||||
# to register the driver
|
||||
{ fetchurl, stdenv, unixODBC, cmake, postgresql, mysql55, mariadb, sqlite, zlib, libxml2 }:
|
||||
|
||||
# I haven't done any parameter tweaking.. So the defaults provided here might be bad
|
||||
|
||||
{
|
||||
# new postgres connector library (doesn't work yet)
|
||||
psqlng = rec {
|
||||
deriv = stdenv.mkDerivation {
|
||||
name = "unix-odbc-pg-odbcng-0.90.101";
|
||||
buildInputs = [ unixODBC glibc libtool postgresql ];
|
||||
# added -ltdl to resolve missing references `dlsym' `dlerror' `dlopen' `dlclose'
|
||||
preConfigure="
|
||||
export CPPFLAGS=-I${unixODBC}/include
|
||||
export LDFLAGS='-L${unixODBC}/lib -lltdl'
|
||||
";
|
||||
src = fetchurl {
|
||||
# using my mirror because original url is https
|
||||
# https://projects.commandprompt.com/public/odbcng/attachment/wiki/Downloads/odbcng-0.90.101.tar.gz";
|
||||
url = http://mawercer.de/~publicrepos/odbcng-0.90.101.tar.gz;
|
||||
sha256 = "13z3sify4z2jcil379704w0knkpflg6di4jh6zx1x2gdgzydxa1y";
|
||||
};
|
||||
meta = {
|
||||
description = "unix odbc driver for postgresql";
|
||||
homepage = https://projects.commandprompt.com/public/odbcng;
|
||||
license = stdenv.lib.licenses.gpl2;
|
||||
};
|
||||
};
|
||||
ini = "";
|
||||
};
|
||||
# official postgres connector
|
||||
psql = rec {
|
||||
deriv = stdenv.mkDerivation rec {
|
||||
name = "psqlodbc-09.03.0100";
|
||||
buildInputs = [ unixODBC libtool postgresql openssl ];
|
||||
preConfigure="
|
||||
export CPPFLAGS=-I${unixODBC}/include
|
||||
export LDFLAGS='-L${unixODBC}/lib -lltdl'
|
||||
";
|
||||
# added -ltdl to resolve missing references `dlsym' `dlerror' `dlopen' `dlclose'
|
||||
psql = stdenv.mkDerivation rec {
|
||||
name = "psqlodbc-${version}";
|
||||
version = "09.05.0210";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://ftp.postgresql.org/pub/odbc/versions/src/${name}.tar.gz";
|
||||
sha256 = "0mh10chkmlppidnmvgbp47v5jnphsrls28zwbvyk2crcn8gdx9q1";
|
||||
sha256 = "0317zrxaiy209xzcc6b5sz6hsyiv4zm74iikp91rgz7z3ll4n4dc";
|
||||
};
|
||||
meta = {
|
||||
description = "unix odbc driver for postgresql";
|
||||
homepage = http://pgfoundry.org/projects/psqlodbc/;
|
||||
license = "LGPL";
|
||||
|
||||
buildInputs = [ unixODBC postgresql ];
|
||||
|
||||
passthru = {
|
||||
fancyName = "PostgreSQL";
|
||||
driver = "lib/psqlodbcw.so";
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Official PostgreSQL ODBC Driver";
|
||||
homepage = https://odbc.postgresql.org/;
|
||||
license = licenses.lgpl2;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
};
|
||||
ini =
|
||||
"[PostgreSQL]\n" +
|
||||
"Description = official PostgreSQL driver for Linux & Win32\n" +
|
||||
"Driver = ${deriv}/lib/psqlodbcw.so\n" +
|
||||
"Threading = 2\n";
|
||||
};
|
||||
# mysql connector
|
||||
mysql = rec {
|
||||
libraries = ["lib/libmyodbc3-3.51.12.so"];
|
||||
deriv = stdenv.mkDerivation {
|
||||
name = "mysql-connector-odbc-3.51.12";
|
||||
src = fetchurl {
|
||||
url = http://ftp.snt.utwente.nl/pub/software/mysql/Downloads/MyODBC3/mysql-connector-odbc-3.51.12.tar.gz;
|
||||
md5 = "a484f590464fb823a8f821b2f1fd7fef";
|
||||
};
|
||||
configureFlags = "--disable-gui"
|
||||
+ " --with-mysql-path=${mysql.lib} --with-unixODBC=${unixODBC}";
|
||||
buildInputs = [ libtool zlib ];
|
||||
inherit mysql unixODBC;
|
||||
|
||||
mariadb = stdenv.mkDerivation rec {
|
||||
name = "mariadb-connector-odbc-${version}";
|
||||
version = "2.0.10";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.mariadb.org/interstitial/connector-odbc-${version}/src/${name}-ga-src.tar.gz";
|
||||
sha256 = "0b6ximy0dg0xhqbrm1l7pn8hjapgpmddi67kh54h6i9cq9hqfdvz";
|
||||
};
|
||||
ini =
|
||||
"[MYSQL]\n" +
|
||||
"Description = MySQL driver\n" +
|
||||
"Driver = ${deriv}/lib/libmyodbc3-3.51.12.so\n" +
|
||||
"CPTimeout = \n" +
|
||||
"CPReuse = \n" +
|
||||
"FileUsage = 3\n ";
|
||||
};
|
||||
sqlite = rec {
|
||||
deriv = let version = "0.995"; in
|
||||
stdenv.mkDerivation {
|
||||
name = "sqlite-connector-odbc-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz";
|
||||
sha256 = "1r97fw6xy5w2f8c0ii7blfqfi6salvd3k8wnxpx9wqc1gxk8jnyy";
|
||||
};
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ unixODBC mariadb ];
|
||||
|
||||
buildInputs = [ sqlite ];
|
||||
cmakeFlags = [
|
||||
"-DMARIADB_INCLUDE_DIR=${mariadb.lib}/include/mysql"
|
||||
];
|
||||
|
||||
configureFlags = "--with-sqlite3=${sqlite} --with-odbc=${unixODBC}";
|
||||
preConfigure = ''
|
||||
sed -i \
|
||||
-e 's,mariadb_config,mysql_config,g' \
|
||||
-e 's,libmariadbclient,libmysqlclient,g' \
|
||||
cmake/FindMariaDB.cmake
|
||||
'';
|
||||
|
||||
# move libraries to $out/lib where they're expected to be
|
||||
postInstall = ''
|
||||
mkdir -p "$out/lib"
|
||||
mv "$out"/*.so "$out/lib"
|
||||
mv "$out"/*.la "$out/lib"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "ODBC driver for SQLite";
|
||||
homepage = http://www.ch-werner.de/sqliteodbc;
|
||||
license = stdenv.lib.licenses.bsd2;
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
maintainers = with stdenv.lib.maintainers; [ vlstill ];
|
||||
};
|
||||
passthru = {
|
||||
fancyName = "MariaDB";
|
||||
driver = "lib/libmyodbc3-3.51.12.so";
|
||||
};
|
||||
ini =
|
||||
"[SQLite]\n" +
|
||||
"Description = SQLite ODBC Driver\n" +
|
||||
"Driver = ${deriv}/lib/libsqlite3odbc.so\n" +
|
||||
"Setup = ${deriv}/lib/libsqlite3odbc.so\n" +
|
||||
"Threading = 2\n";
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "MariaDB ODBC database driver";
|
||||
homepage = https://downloads.mariadb.org/connector-odbc/;
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.linux;
|
||||
broken = true;
|
||||
};
|
||||
};
|
||||
|
||||
mysql = stdenv.mkDerivation rec {
|
||||
name = "mysql-connector-odbc-${version}";
|
||||
majorVersion = "5.3";
|
||||
version = "${majorVersion}.6";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://dev.mysql.com/get/Downloads/Connector-ODBC/${majorVersion}/${name}-src.tar.gz";
|
||||
sha256 = "1smi4z49i4zm7cmykjkwlxxzqvn7myngsw5bc35z6gqxmi8c55xr";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ unixODBC mysql55 ];
|
||||
|
||||
cmakeFlags = [ "-DWITH_UNIXODBC=1" ];
|
||||
|
||||
passthru = {
|
||||
fancyName = "MySQL";
|
||||
driver = "lib/libmyodbc3-3.51.12.so";
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "MariaDB ODBC database driver";
|
||||
homepage = https://dev.mysql.com/downloads/connector/odbc/;
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.linux;
|
||||
broken = true;
|
||||
};
|
||||
};
|
||||
|
||||
sqlite = stdenv.mkDerivation rec {
|
||||
name = "sqlite-connector-odbc-${version}";
|
||||
version = "0.9993";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz";
|
||||
sha256 = "0dgsj28sc7f7aprmdd0n5a1rmcx6pv7170c8dfjl0x1qsjxim6hs";
|
||||
};
|
||||
|
||||
buildInputs = [ unixODBC sqlite zlib libxml2 ];
|
||||
|
||||
configureFlags = [ "--with-odbc=${unixODBC}" ];
|
||||
|
||||
installTargets = [ "install-3" ];
|
||||
|
||||
# move libraries to $out/lib where they're expected to be
|
||||
postInstall = ''
|
||||
mkdir -p "$out/lib"
|
||||
mv "$out"/*.* "$out/lib"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
fancyName = "SQLite";
|
||||
driver = "lib/libsqlite3odbc.so";
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "ODBC driver for SQLite";
|
||||
homepage = http://www.ch-werner.de/sqliteodbc;
|
||||
license = licenses.bsd2;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ vlstill ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue