1{ lib, stdenv, fetchFromGitHub, fetchpatch, postgresql }:
2
3stdenv.mkDerivation rec {
4 pname = "pg_bigm";
5 version = "1.2-20200228";
6
7 src = fetchFromGitHub {
8 owner = "pgbigm";
9 repo = "pg_bigm";
10 rev = "v${version}";
11 hash = "sha256-3lspEglVWzEUTiRIWqW0DpQe8gDn9R/RxsWuI9znYc8=";
12 };
13
14 patches = [
15 # Fix compatiblity with PostgreSQL 16. Remove with the next release.
16 (fetchpatch {
17 url = "https://github.com/pgbigm/pg_bigm/commit/2a9d783c52a1d7a2eb414da6f091f6035da76edf.patch";
18 hash = "sha256-LuMpSUPnT8cPChQfA9sJEKP4aGpsbN5crfTKLnDzMN8=";
19 })
20 ];
21
22 buildInputs = [ postgresql ];
23
24 makeFlags = [ "USE_PGXS=1" ];
25
26 installPhase = ''
27 install -D -t $out/lib pg_bigm${postgresql.dlSuffix}
28 install -D -t $out/share/postgresql/extension *.sql
29 install -D -t $out/share/postgresql/extension *.control
30 '';
31
32 meta = with lib; {
33 description = "Text similarity measurement and index searching based on bigrams";
34 homepage = "https://pgbigm.osdn.jp/";
35 maintainers = [ maintainers.marsam ];
36 platforms = postgresql.meta.platforms;
37 license = licenses.postgresql;
38 };
39}