about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/sql/postgresql/ext/pg_similarity.nix
blob: 85ff50e2eae8c1fa0f46be669089764df9a7822f (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
{ stdenv, lib, fetchFromGitHub, gcc, postgresql }:

stdenv.mkDerivation {

  name = "pg_similarity-1.0";
  src = fetchFromGitHub {
    owner = "eulerto";
    repo = "pg_similarity";
    rev = "be1a8b08c8716e59b89982557da9ea68cdf868c5";
    sha256 = "1z4v4r2yccdr8kz3935fnk1bc5vj0qj0apscldyap4wxlyi89xim";
  };

  buildInputs = [ postgresql gcc ];
  buildPhase = "USE_PGXS=1 make";
  installPhase = ''
    mkdir -p $out/bin   # for buildEnv to setup proper symlinks
    install -D pg_similarity.so -t $out/lib/
    install -D ./{pg_similarity--unpackaged--1.0.sql,pg_similarity--1.0.sql,pg_similarity.control} -t $out/share/postgresql/extension
  '';

  meta = {
    description = ''
       pg_similarity is an extension to support similarity queries on PostgreSQL. The implementation
       is tightly integrated in the RDBMS in the sense that it defines operators so instead of the traditional
       operators (= and <>) you can use ~~~ and ~!~ (any of these operators represents a similarity function).
    '';
    platforms = postgresql.meta.platforms;
    license = stdenv.lib.licenses.gpl2;
    maintainers = with lib.maintainers; [ danbst ];
  };
}