1{ lib, stdenv, fetchurl, zlib, readline, libossp_uuid, openssl }:
2
3let
4
5 common = { version, sha256, psqlSchema } @ args: stdenv.mkDerivation (rec {
6 name = "postgresql-${version}";
7
8 src = fetchurl {
9 url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
10 inherit sha256;
11 };
12
13 outputs = [ "out" "doc" ];
14
15 buildInputs =
16 [ zlib readline openssl ]
17 ++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ];
18
19 enableParallelBuilding = true;
20
21 makeFlags = [ "world" ];
22
23 configureFlags =
24 [ "--with-openssl" ]
25 ++ lib.optional (stdenv.isDarwin) "--with-uuid=e2fs"
26 ++ lib.optional (!stdenv.isDarwin) "--with-ossp-uuid";
27
28 patches =
29 [ (if lib.versionAtLeast version "9.4" then ./disable-resolve_symlinks-94.patch else ./disable-resolve_symlinks.patch)
30 ./less-is-more.patch
31 ];
32
33 installTargets = [ "install-world" ];
34
35 LC_ALL = "C";
36
37 postInstall =
38 ''
39 # Prevent a retained dependency on gcc-wrapper.
40 substituteInPlace $out/lib/pgxs/src/Makefile.global --replace ${stdenv.cc}/bin/ld ld
41 '';
42
43 disallowedReferences = [ stdenv.cc ];
44
45 passthru = {
46 inherit readline psqlSchema;
47 };
48
49 meta = with lib; {
50 homepage = http://www.postgresql.org/;
51 description = "A powerful, open source object-relational database system";
52 license = licenses.postgresql;
53 maintainers = [ maintainers.ocharles ];
54 platforms = platforms.unix;
55 hydraPlatforms = platforms.linux;
56 };
57 });
58
59in {
60
61 postgresql90 = common {
62 version = "9.0.22";
63 psqlSchema = "9.0";
64 sha256 = "19gq6axjhvlr5zlrzwnll1fbrvai4xh0nb1jki6gmmschl6v5m4l";
65 };
66
67 postgresql91 = common {
68 version = "9.1.18";
69 psqlSchema = "9.1";
70 sha256 = "1a44hmcvfaa8j169ladsibmvjakw6maaxqkzz1ab8139cqkda9i7";
71 };
72
73 postgresql92 = common {
74 version = "9.2.13";
75 psqlSchema = "9.2";
76 sha256 = "0i3avdr8mnvn6ldkx0hc4jmclhisb2338hzs0j2m03wck8hddjsx";
77 };
78
79 postgresql93 = common {
80 version = "9.3.9";
81 psqlSchema = "9.3";
82 sha256 = "0j85j69rf54cwz5yhrhk4ca22b82990j5sqb8cr1fl9843nd0fzp";
83 };
84
85 postgresql94 = common {
86 version = "9.4.4";
87 psqlSchema = "9.4";
88 sha256 = "04q07g209y99xzjh88y52qpvz225rxwifv8nzp3bxzfni2bdk3jk";
89 };
90
91}