about summary refs log tree commit diff
path: root/pkgs/servers/sql/postgresql/ext/pg_libversion.nix
blob: 9d4d46a769b49254d73285d8b02146e640c32d53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 { lib
, stdenv
, fetchFromGitHub
, pkg-config
, postgresql
, libversion
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "pg_libversion";
  version = "2.0.0";

  src = fetchFromGitHub {
    owner = "repology";
    repo = "postgresql-libversion";
    rev = finalAttrs.version;
    hash = "sha256-60HX/Y+6QIzqmDnjNpgO4GCbDhNfeek9myMWoYLdrAA=";
  };

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    postgresql
    libversion
  ];

  installPhase = ''
    runHook preInstall

    install -D -t $out/lib libversion${postgresql.dlSuffix}
    install -D -t $out/share/postgresql/extension *.sql
    install -D -t $out/share/postgresql/extension *.control

    runHook postInstall
  '';

  meta = with lib; {
    description = "PostgreSQL extension with support for version string comparison";
    homepage = "https://github.com/repology/postgresql-libversion";
    license = licenses.mit;
    maintainers = [ maintainers.jopejoe1 ];
    platforms = postgresql.meta.platforms;
  };
})