about summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/dns/bind/default.nix139
-rw-r--r--pkgs/servers/monitoring/riemann/default.nix4
-rw-r--r--pkgs/servers/sql/mariadb/default.nix4
-rw-r--r--pkgs/servers/sql/postgresql/8.4.x.nix31
-rw-r--r--pkgs/servers/sql/postgresql/9.0.x.nix36
-rw-r--r--pkgs/servers/sql/postgresql/9.1.x.nix44
-rw-r--r--pkgs/servers/sql/postgresql/9.2.x.nix42
-rw-r--r--pkgs/servers/sql/postgresql/9.3.x.nix46
-rw-r--r--pkgs/servers/sql/postgresql/9.4.x.nix46
-rw-r--r--pkgs/servers/sql/postgresql/generic.nix108
10 files changed, 270 insertions, 230 deletions
diff --git a/pkgs/servers/dns/bind/default.nix b/pkgs/servers/dns/bind/default.nix
index fbfa2d8d9b7d..70d88b2a9689 100644
--- a/pkgs/servers/dns/bind/default.nix
+++ b/pkgs/servers/dns/bind/default.nix
@@ -1,12 +1,47 @@
-{ stdenv, fetchurl, openssl, libtool, perl, libxml2 }:
+{ stdenv, fetchurl, libtool, docbook5_xsl
 
-let version = "9.10.2"; in
+# Optional Dependencies
+, libseccomp ? null, python ? null, kerberos ? null, openssl ? null
+, libxml2 ? null, json_c ? null, readline ? null, libcap ? null, idnkit ? null
+, libiconv ? null
 
+# Optional DLZ Modules
+, postgresql ? null, libmysql ? null, db ? null, openldap ? null
+
+# Extra arguments
+, suffix ? ""
+}:
+
+with stdenv;
+let
+  version = "9.10.2";
+
+  toolsOnly = suffix == "tools";
+
+  optLibseccomp = shouldUsePkg libseccomp;
+  optPython = if toolsOnly then null else shouldUsePkg python;
+  optKerberos = shouldUsePkg kerberos;
+  optOpenssl = shouldUsePkg openssl;
+  optLibxml2 = shouldUsePkg libxml2;
+  optJson_c = shouldUsePkg json_c;
+  optReadline = shouldUsePkg readline;
+  optLibcap = if !stdenv.isLinux then null else shouldUsePkg libcap;
+  optIdnkit = shouldUsePkg idnkit;
+  optLibiconv = shouldUsePkg libiconv;
+
+  optPostgresql = if toolsOnly then null else shouldUsePkg postgresql;
+  optLibmysql = if toolsOnly then null else shouldUsePkg libmysql;
+  optDb = if toolsOnly then null else shouldUsePkg db;
+  optOpenldap = if toolsOnly then null else shouldUsePkg openldap;
+
+  pythonBin = if optPython == null then null else "${optPython}/bin/python";
+in
+with stdenv.lib;
 stdenv.mkDerivation rec {
-  name = "bind-${version}";
+  name = "bind${optionalString (suffix != "") "-${suffix}"}-${version}";
 
   src = fetchurl {
-    url = "http://ftp.isc.org/isc/bind9/${version}/${name}.tar.gz";
+    url = "http://ftp.isc.org/isc/bind9/${version}/bind-${version}.tar.gz";
     sha256 = "163s8pvqj4lyryvfzkc6acbys7gw1by5dqwilggiwp54ia8bg6vg";
   };
 
@@ -14,30 +49,90 @@ stdenv.mkDerivation rec {
     sed -i 's/^\t.*run/\t/' Makefile.in
   '';
 
-  buildInputs = [ openssl libtool perl libxml2 ];
+  nativeBuildInputs = [ optPython libtool docbook5_xsl ];
+  buildInputs = [
+    optLibseccomp optPython optKerberos optOpenssl optLibxml2 optJson_c
+    optReadline optLibcap optIdnkit optLibiconv optPostgresql optLibmysql
+    optDb optOpenldap
+  ];
 
   configureFlags = [
-    "--localstatedir=/var"
-    "--with-libtool"
-    "--with-libxml2=${libxml2}"
-    "--with-openssl=${openssl}"
-    "--without-atf"
-    "--without-dlopen"
-    "--without-docbook-xsl"
-    "--without-gssapi"
-    "--without-idn"
-    "--without-idnlib"
-    "--without-pkcs11"
-    "--without-purify"
-    "--without-python"
+    (mkOther                          "localstatedir"       "/var")
+    (mkOther                          "sysconfdir"          "/etc")
+    (mkEnable (optLibseccomp != null) "seccomp"             null)
+    (mkWith   (optPython != null)     "python"              pythonBin)
+    (mkEnable true                    "kqueue"              null)
+    (mkEnable true                    "epoll"               null)
+    (mkEnable true                    "devpoll"             null)
+    (mkWith   false                   "geoip"               null)  # TODO(wkennington): GeoDNS support
+    (mkWith   (optKerberos != null)   "gssapi"              optKerberos)
+    (mkWith   true                    "libtool"             null)
+    (mkEnable (optOpenssl == null)    "native-pkcs11"       null)
+    (mkWith   (optOpenssl != null)    "openssl"             optOpenssl)
+    (mkWith   true                    "pkcs11"              null)
+    (mkWith   true                    "ecdsa"               null)
+    (mkWith   false                   "gost"                null)  # Insecure cipher
+    (mkWith   true                    "aes"                 null)
+    (mkEnable (optOpenssl != null)    "openssl-hash"        null)
+    (mkEnable true                    "sit"                 null)
+    (mkWith   true                    "sit-alg"             "aes")
+    (mkWith   (optLibxml2 != null)    "libxml2"             optLibxml2)
+    (mkWith   (optJson_c != null)     "libjson"             optJson_c)
+    (mkEnable true                    "largefile"           null)
+    (mkWith   false                   "purify"              null)
+    (mkWith   false                   "gperftools-profiler" null)
+    (mkEnable false                   "backtrace"           null)
+    (mkEnable false                   "symtable"            null)
+    (mkEnable true                    "ipv6"                null)
+    (mkWith   false                   "kame"                null)
+    (mkWith   (optReadline != null)   "readline"            null)
+    (mkEnable (optKerberos == null)   "isc-spnego"          null)
+    (mkEnable true                    "chroot"              null)
+    (mkEnable (optLibcap != null)     "linux-caps"          null)
+    (mkEnable true                    "atomic"              null)
+    (mkEnable false                   "fixed-rrset"         null)
+    (mkEnable true                    "rpz-nsip"            null)
+    (mkEnable true                    "rpz-nsdname"         null)
+    (mkEnable true                    "filter-aaaa"         null)
+    (mkWith   true                    "docbook-xsl"         "${docbook5_xsl}/share/xsl/docbook")
+    (mkWith   (optIdnkit != null)     "idn"                 optIdnkit)
+    (mkWith   (optLibiconv != null)   "libiconv"            optLibiconv)
+    (mkWith   false                   "atf"                 null)
+    (mkWith   true                    "tuning"              "large")
+    (mkWith   true                    "dlopen"              null)
+    (mkWith   false                   "make-clean"          null)
+    (mkEnable true                    "full-report"         null)
+    (mkWith   (optPostgresql != null) "dlz-postgres"        optPostgresql)
+    (mkWith   (optLibmysql != null)   "dlz-mysql"           optLibmysql)
+    (mkWith   (optDb != null)         "dlz-bdb"             optDb)
+    (mkWith   true                    "dlz-filesystem"      null)
+    (mkWith   (optOpenldap != null)   "dlz-ldap"            optOpenldap)
+    (mkWith   false                   "dlz-odbc"            null)
+    (mkWith   true                    "dlz-stub"            null)
   ];
 
+  installFlags = [
+    "sysconfdir=\${out}/etc"
+    "localstatedir=\${TMPDIR}"
+  ] ++ optionals toolsOnly [
+    "DESTDIR=\${TMPDIR}"
+  ];
+
+  postInstall = optionalString toolsOnly ''
+    mkdir -p $out/{bin,etc,lib,share/man/man1}
+    install -m 0755 $TMPDIR/$out/bin/{dig,nslookup,nsupdate} $out/bin
+    install -m 0644 $TMPDIR/$out/etc/bind.keys $out/etc
+    install -m 0644 $TMPDIR/$out/lib/*.so.* $out/lib
+    install -m 0644 $TMPDIR/$out/share/man/man1/{dig,nslookup,nsupdate}.1 $out/share/man/man1
+  '';
+
+  enableParallelBuilding = true;
+
   meta = {
     homepage = "http://www.isc.org/software/bind";
     description = "Domain name server";
-    license = stdenv.lib.licenses.isc;
-
-    maintainers = with stdenv.lib.maintainers; [viric simons];
-    platforms = with stdenv.lib.platforms; unix;
+    license = licenses.isc;
+    maintainers = with maintainers; [ viric simons wkennington ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/servers/monitoring/riemann/default.nix b/pkgs/servers/monitoring/riemann/default.nix
index f8cd73605ca9..132275a56e09 100644
--- a/pkgs/servers/monitoring/riemann/default.nix
+++ b/pkgs/servers/monitoring/riemann/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "riemann-${version}";
-  version = "0.2.8";
+  version = "0.2.9";
 
   src = fetchurl {
     url = "http://aphyr.com/riemann/${name}.tar.bz2";
-    sha256 = "1p2pdkxy2xc5zlj6kadf4z8l0f0r4bvdgipqf52193l7rdm6dfzm";
+    sha256 = "10zz92sg9ak8g7xsfc05p4kic6hzwj7nqpkjgsd8f7f3slvfjqw3";
   };
 
   phases = [ "unpackPhase" "installPhase" ];
diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix
index fe7c70ced2d0..21ccd50e3ef5 100644
--- a/pkgs/servers/sql/mariadb/default.nix
+++ b/pkgs/servers/sql/mariadb/default.nix
@@ -5,11 +5,11 @@
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "mariadb-${version}";
-  version = "10.0.18";
+  version = "10.0.19";
 
   src = fetchurl {
     url    = "https://downloads.mariadb.org/interstitial/mariadb-${version}/source/mariadb-${version}.tar.gz";
-    sha256 = "1xcs391cm0vnl9bvx1470v8z4d77zqv16n6iaqi12jm0ma8fwvv8";
+    sha256 = "0cm1j4805ypbmrhajn4ar5rqsis1p5haxs7c04b6k540gmfmxgrg";
   };
 
   buildInputs = [ cmake ncurses openssl zlib pcre libxml2 boost judy bison libevent ]
diff --git a/pkgs/servers/sql/postgresql/8.4.x.nix b/pkgs/servers/sql/postgresql/8.4.x.nix
index d77a539cb5d9..0254bbe951d6 100644
--- a/pkgs/servers/sql/postgresql/8.4.x.nix
+++ b/pkgs/servers/sql/postgresql/8.4.x.nix
@@ -1,30 +1,11 @@
-{ stdenv, fetchurl, zlib, ncurses, readline, openssl }:
+{ callPackage, fetchurl, ... } @ args:
 
-let version = "8.4.22"; in
-
-stdenv.mkDerivation rec {
-  name = "postgresql-${version}";
+callPackage ./generic.nix (args // rec {
+  psqlSchema = "8.4";
+  version = "${psqlSchema}.22";
 
   src = fetchurl {
-    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
+    url = "mirror://postgresql/source/v${version}/postgresql-${version}.tar.bz2";
     sha256 = "09iqr9sldiq7jz1rdnywp2wv36lxy5m8kch3vpchd1s4fz75c7aw";
   };
-
-  buildInputs = [ zlib ncurses readline openssl ];
-
-  LC_ALL = "C";
-
-  configureFlags = [ "--with-openssl" ];
-
-  patches = [ ./less-is-more.patch ];
-
-  passthru = { inherit readline; };
-
-  meta = {
-    homepage = http://www.postgresql.org/;
-    description = "A powerful, open source object-relational database system";
-    license = stdenv.lib.licenses.postgresql;
-    maintainers = [ stdenv.lib.maintainers.ocharles ];
-    hydraPlatforms = stdenv.lib.platforms.linux;
-  };
-}
+})
diff --git a/pkgs/servers/sql/postgresql/9.0.x.nix b/pkgs/servers/sql/postgresql/9.0.x.nix
index 340307c01f90..dba42e4fb110 100644
--- a/pkgs/servers/sql/postgresql/9.0.x.nix
+++ b/pkgs/servers/sql/postgresql/9.0.x.nix
@@ -1,33 +1,11 @@
-{ stdenv, fetchurl, zlib, readline, openssl }:
+{ callPackage, fetchurl, ... } @ args:
 
-let version = "9.0.19"; in
-
-stdenv.mkDerivation rec {
-  name = "postgresql-${version}";
+callPackage ./generic.nix (args // rec {
+  psqlSchema = "9.0";
+  version = "${psqlSchema}.20";
 
   src = fetchurl {
-    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "1h45jdbzdcvprdsi9gija81s3ny46h3faf9f007gza4vm6y15bak";
-  };
-
-  buildInputs = [ zlib readline openssl ];
-
-  LC_ALL = "C";
-
-  configureFlags = [ "--with-openssl" ];
-
-  patches = [ ./less-is-more.patch ];
-
-  passthru = {
-    inherit readline;
-    psqlSchema = "9.0";
-  };
-
-  meta = {
-    homepage = http://www.postgresql.org/;
-    description = "A powerful, open source object-relational database system";
-    license = stdenv.lib.licenses.postgresql;
-    maintainers = [ stdenv.lib.maintainers.ocharles ];
-    hydraPlatforms = stdenv.lib.platforms.linux;
+    url = "mirror://postgresql/source/v${version}/postgresql-${version}.tar.bz2";
+    sha256 = "0vxa90d1ghv6vg4c6kxvm2skypahvlq4sd968q7l9ff3dl145z02";
   };
-}
+})
diff --git a/pkgs/servers/sql/postgresql/9.1.x.nix b/pkgs/servers/sql/postgresql/9.1.x.nix
index 5b0774d6229c..138bc4a30232 100644
--- a/pkgs/servers/sql/postgresql/9.1.x.nix
+++ b/pkgs/servers/sql/postgresql/9.1.x.nix
@@ -1,41 +1,11 @@
-{ stdenv, fetchurl, zlib, readline, openssl }:
+{ callPackage, fetchurl, ... } @ args:
 
-let version = "9.1.15"; in
-
-stdenv.mkDerivation rec {
-  name = "postgresql-${version}";
+callPackage ./generic.nix (args // rec {
+  psqlSchema = "9.1";
+  version = "${psqlSchema}.16";
 
   src = fetchurl {
-    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "0pyyw0cy91z9wkqf8qzkwsy8cyjps0s94c9czz6mzhyd2npxxmk7";
-  };
-
-  buildInputs = [ zlib readline openssl ];
-
-  enableParallelBuilding = true;
-
-  LC_ALL = "C";
-
-  configureFlags = [ "--with-openssl" ];
-
-  patches = [ ./less-is-more.patch ];
-
-  postInstall =
-    ''
-      mkdir -p $out/share/man
-      cp -rvd doc/src/sgml/man1 $out/share/man
-    '';
-
-  passthru = {
-    inherit readline;
-    psqlSchema = "9.1";
-  };
-
-  meta = {
-    homepage = http://www.postgresql.org/;
-    description = "A powerful, open source object-relational database system";
-    license = stdenv.lib.licenses.postgresql;
-    maintainers = [ stdenv.lib.maintainers.ocharles ];
-    hydraPlatforms = stdenv.lib.platforms.linux;
+    url = "mirror://postgresql/source/v${version}/postgresql-${version}.tar.bz2";
+    sha256 = "0mllj1r1648iwm0qj3cj9qxizhlyhqmz94iydnwhf48psvvy4r9b";
   };
-}
+})
diff --git a/pkgs/servers/sql/postgresql/9.2.x.nix b/pkgs/servers/sql/postgresql/9.2.x.nix
index d09cde5b995f..9517b4e803cc 100644
--- a/pkgs/servers/sql/postgresql/9.2.x.nix
+++ b/pkgs/servers/sql/postgresql/9.2.x.nix
@@ -1,39 +1,11 @@
-{ stdenv, fetchurl, zlib, readline, openssl }:
+{ callPackage, fetchurl, ... } @ args:
 
-let version = "9.2.10"; in
-
-stdenv.mkDerivation rec {
-  name = "postgresql-${version}";
+callPackage ./generic.nix (args // rec {
+  psqlSchema = "9.2";
+  version = "${psqlSchema}.11";
 
   src = fetchurl {
-    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "1bbkinqzb3c8i0vfzcy2g7djrq0kxz63jgvzda9p0vylxazmnm1m";
-  };
-
-  buildInputs = [ zlib readline openssl ];
-
-  enableParallelBuilding = true;
-
-  makeFlags = [ "world" ];
-
-  configureFlags = [ "--with-openssl" ];
-
-  patches = [ ./disable-resolve_symlinks.patch ./less-is-more.patch ];
-
-  installTargets = [ "install-world" ];
-
-  LC_ALL = "C";
-
-  passthru = {
-    inherit readline;
-    psqlSchema = "9.2";
-  };
-
-  meta = {
-    homepage = http://www.postgresql.org/;
-    description = "A powerful, open source object-relational database system";
-    license = stdenv.lib.licenses.postgresql;
-    maintainers = [ stdenv.lib.maintainers.ocharles ];
-    hydraPlatforms = stdenv.lib.platforms.linux;
+    url = "mirror://postgresql/source/v${version}/postgresql-${version}.tar.bz2";
+    sha256 = "1k5i73ninqyz76zzpi06ajj5qawf30zwr16x8wrgq6swzvsgbck5";
   };
-}
+})
diff --git a/pkgs/servers/sql/postgresql/9.3.x.nix b/pkgs/servers/sql/postgresql/9.3.x.nix
index 6467ce80af1e..fabc6dbc1ded 100644
--- a/pkgs/servers/sql/postgresql/9.3.x.nix
+++ b/pkgs/servers/sql/postgresql/9.3.x.nix
@@ -1,43 +1,11 @@
-{ stdenv, fetchurl, zlib, readline, libossp_uuid, openssl}:
+{ callPackage, fetchurl, ... } @ args:
 
-with stdenv.lib;
-
-let version = "9.3.6"; in
-
-stdenv.mkDerivation rec {
-  name = "postgresql-${version}";
+callPackage ./generic.nix (args // rec {
+  psqlSchema = "9.3";
+  version = "${psqlSchema}.7";
 
   src = fetchurl {
-    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "056ass7nnfyv7blv02anv795kgpz77gipdpxggd835cdwrhwns13";
-  };
-
-  buildInputs = [ zlib readline openssl ]
-                ++ optionals (!stdenv.isDarwin) [ libossp_uuid ];
-
-  enableParallelBuilding = true;
-
-  makeFlags = [ "world" ];
-
-  configureFlags = [ "--with-openssl" ]
-                   ++ optional (!stdenv.isDarwin) "--with-ossp-uuid";
-
-  patches = [ ./disable-resolve_symlinks.patch ./less-is-more.patch ];
-
-  installTargets = [ "install-world" ];
-
-  LC_ALL = "C";
-
-  passthru = {
-    inherit readline;
-    psqlSchema = "9.3";
-  };
-
-  meta = {
-    homepage = http://www.postgresql.org/;
-    description = "A powerful, open source object-relational database system";
-    license = stdenv.lib.licenses.postgresql;
-    maintainers = [ stdenv.lib.maintainers.ocharles ];
-    hydraPlatforms = stdenv.lib.platforms.linux;
+    url = "mirror://postgresql/source/v${version}/postgresql-${version}.tar.bz2";
+    sha256 = "0ggz0i91znv053zx9qas7pjf93s5by3dk84z1jxbjkg8yyrnlx4b";
   };
-}
+})
diff --git a/pkgs/servers/sql/postgresql/9.4.x.nix b/pkgs/servers/sql/postgresql/9.4.x.nix
index 6649975d7902..0d8b573dcc56 100644
--- a/pkgs/servers/sql/postgresql/9.4.x.nix
+++ b/pkgs/servers/sql/postgresql/9.4.x.nix
@@ -1,43 +1,11 @@
-{ stdenv, fetchurl, zlib, readline, libossp_uuid, openssl }:
+{ callPackage, fetchurl, ... } @ args:
 
-with stdenv.lib;
-
-let version = "9.4.1"; in
-
-stdenv.mkDerivation rec {
-  name = "postgresql-${version}";
+callPackage ./generic.nix (args // rec {
+  psqlSchema = "9.4";
+  version = "${psqlSchema}.2";
 
   src = fetchurl {
-    url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "19n3i14bhmw8dacd2kl3n1wzj362qv3fjmal5vsvi580h9ybgp99";
-  };
-
-  buildInputs = [ zlib readline openssl ]
-                ++ optionals (!stdenv.isDarwin) [ libossp_uuid ];
-
-  enableParallelBuilding = true;
-
-  makeFlags = [ "world" ];
-
-  configureFlags = [ "--with-openssl" ]
-                   ++ optional (!stdenv.isDarwin) "--with-ossp-uuid";
-
-  patches = [ ./disable-resolve_symlinks-94.patch ./less-is-more.patch ];
-
-  installTargets = [ "install-world" ];
-
-  LC_ALL = "C";
-
-  passthru = {
-    inherit readline;
-    psqlSchema = "9.4";
-  };
-
-  meta = {
-    homepage = http://www.postgresql.org/ ;
-    description = "A powerful, open source object-relational database system";
-    license = stdenv.lib.licenses.postgresql;
-    maintainers = with stdenv.lib.maintainers; [ aristid ocharles ];
-    hydraPlatforms = stdenv.lib.platforms.linux;
+    url = "mirror://postgresql/source/v${version}/postgresql-${version}.tar.bz2";
+    sha256 = "04adpfg2f7ip96rh3jjygx5cpgasrrp1dl2wswjivfk5q68s3zc1";
   };
-}
+})
diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix
new file mode 100644
index 000000000000..ded9247f42a1
--- /dev/null
+++ b/pkgs/servers/sql/postgresql/generic.nix
@@ -0,0 +1,108 @@
+{ stdenv, bison, flex
+, gettext
+
+# Optional Dependencies
+, kerberos ? null, pam ? null, openldap ? null, openssl ? null, readline ? null
+, libossp_uuid ? null, libxml2 ? null, libxslt ? null, zlib ? null
+
+# Extra Arguments
+, blockSizeKB ? 8, segmentSizeGB ? 1
+, walBlockSizeKB ? 8, walSegmentSizeMB ? 16
+
+# Version specific arguments
+, psqlSchema , version, src
+, ...
+}:
+
+with stdenv;
+let
+  optKerberos = shouldUsePkg kerberos;
+  optPam = shouldUsePkg pam;
+  optOpenldap = shouldUsePkg openldap;
+  optOpenssl = shouldUsePkg openssl;
+  optReadline = shouldUsePkg readline;
+  optLibossp_uuid = shouldUsePkg libossp_uuid;
+  optLibxml2 = shouldUsePkg libxml2;
+  optLibxslt = shouldUsePkg libxslt;
+  optZlib = shouldUsePkg zlib;
+in
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "postgresql-${version}";
+
+  inherit src;
+
+  patches = [
+    ./less-is-more.patch
+  ] ++ optionals (versionOlder version "9.4.0") [
+    ./disable-resolve_symlinks.patch
+  ] ++ optionals (versionAtLeast version "9.4.0") [
+    ./disable-resolve_symlinks-94.patch
+  ];
+
+  nativeBuildInputs = [ bison flex ];
+  buildInputs = [
+    gettext optKerberos optPam optOpenldap optOpenssl optReadline
+    optLibossp_uuid optLibxml2 optLibxslt optZlib
+  ];
+
+  configureFlags = [
+    (mkOther                            "sysconfdir"        "/etc")
+    (mkOther                            "localstatedir"     "/var")
+    (mkEnable true                      "integer-datetimes" null)
+    (mkEnable true                      "nls"               null)
+    (mkWith   true                      "pgport"            "5432")
+    (mkEnable true                      "rpath"             null)
+    (mkEnable true                      "spinlocks"         null)
+    (mkEnable false                     "debug"             null)
+    (mkEnable false                     "profiling"         null)
+    (mkEnable false                     "coverage"          null)
+    (mkEnable false                     "dtrace"            null)
+    (mkWith   true                      "blocksize"         (toString blockSizeKB))
+    (mkWith   true                      "segsize"           (toString segmentSizeGB))
+    (mkWith   true                      "wal-blocksize"     (toString walBlockSizeKB))
+    (mkWith   true                      "wal-segsize"       (toString walSegmentSizeMB))
+    (mkEnable true                      "depend"            null)
+    (mkEnable false                     "cassert"           null)
+    (mkEnable true                      "thread-safety"     null)
+    (mkWith   false                     "tcl"               null)  # Maybe enable some day
+    (mkWith   false                     "perl"              null)  # Maybe enable some day
+    (mkWith   false                     "python"            null)  # Maybe enable some day
+    (mkWith   (optKerberos != null)     "gssapi"            null)
+    (mkWith   (optPam != null)          "pam"               null)
+    (mkWith   (optOpenldap != null)     "ldap"              null)
+    (mkWith   false                     "bonjour"           null)
+    (mkWith   (optOpenssl != null)      "openssl"           null)
+    (mkWith   (optReadline != null)     "readline"          null)
+    (mkWith   false                     "libedit-preferred" null)
+    (mkWith   (optLibxml2 != null)      "libxml"            null)
+    (mkWith   (optLibxslt != null)      "libxslt"           null)
+    (mkWith   (optZlib != null)         "zlib"              null)
+  ] ++ optionals (versionAtLeast version "9.1.0") [
+    (mkWith   false                     "selinux"           null)
+  ] ++ optionals (versionOlder version "9.3.0") [
+    (mkEnable true                      "shared"            null)
+  ] ++ optionals (versionAtLeast version "9.4.0") [
+    (mkEnable false                     "tap-tests"         null)
+    (mkWith   (optLibossp_uuid != null) "uuid"              "ossp")
+  ] ++ optionals (versionOlder version "9.4.0") [
+    (mkWith   false                     "krb5"              null)
+    (mkWith   (optLibossp_uuid != null) "ossp-uuid"         null)
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.postgresql.org/;
+    description = "A powerful, open source object-relational database system";
+    license = licenses.postgresql;
+    maintainers = with maintainers; [ ocharles wkennington ];
+    platforms = platforms.unix;
+    hydraPlatforms = platforms.linux;
+  };
+
+  passthru = {
+    inherit psqlSchema;
+    readline = optReadline;
+  };
+}