mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 12:11:28 +00:00
postgresqlPackages.tsja: init at 0.5.0
This commit is contained in:
parent
a190bf43b6
commit
47646a34ba
|
@ -833,6 +833,7 @@ in {
|
|||
trezord = handleTest ./trezord.nix {};
|
||||
trickster = handleTest ./trickster.nix {};
|
||||
trilium-server = handleTestOn ["x86_64-linux"] ./trilium-server.nix {};
|
||||
tsja = handleTest ./tsja.nix {};
|
||||
tsm-client-gui = handleTest ./tsm-client-gui.nix {};
|
||||
txredisapi = handleTest ./txredisapi.nix {};
|
||||
tuptime = handleTest ./tuptime.nix {};
|
||||
|
|
32
nixos/tests/tsja.nix
Normal file
32
nixos/tests/tsja.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
||||
name = "tsja";
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ chayleaf ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
master =
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
extraPlugins = with config.services.postgresql.package.pkgs; [
|
||||
tsja
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
master.wait_for_unit("postgresql")
|
||||
master.succeed("sudo -u postgres psql -f /run/current-system/sw/share/postgresql/extension/libtsja_dbinit.sql")
|
||||
# make sure "日本語" is parsed as a separate lexeme
|
||||
master.succeed("""
|
||||
sudo -u postgres \\
|
||||
psql -c "SELECT * FROM ts_debug('japanese', 'PostgreSQLで日本語のテキスト検索ができます。')" \\
|
||||
| grep "{日本語}"
|
||||
""")
|
||||
'';
|
||||
})
|
45
pkgs/servers/sql/postgresql/ext/tsja.nix
Normal file
45
pkgs/servers/sql/postgresql/ext/tsja.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ lib
|
||||
, fetchzip
|
||||
, nixosTests
|
||||
, stdenv
|
||||
|
||||
, mecab
|
||||
, postgresql
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "tsja";
|
||||
version = "0.5.0";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://www.amris.jp/tsja/tsja-${version}.tar.xz";
|
||||
hash = "sha256-h59UhUG/7biN8NaDiGK6kXDqfhR9uMzt8CpwbJ+PpEM=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace /usr/local/pgsql ${postgresql} \
|
||||
--replace -L/usr/local/lib "" \
|
||||
--replace -I/usr/local/include ""
|
||||
substituteInPlace tsja.c --replace /usr/local/lib/mecab ${mecab}/lib/mecab
|
||||
'';
|
||||
|
||||
buildInputs = [ mecab postgresql ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib $out/share/postgresql/extension
|
||||
mv libtsja.so $out/lib
|
||||
mv dbinit_libtsja.txt $out/share/postgresql/extension/libtsja_dbinit.sql
|
||||
'';
|
||||
|
||||
passthru.tests.tsja = nixosTests.tsja;
|
||||
|
||||
meta = with lib; {
|
||||
description = "PostgreSQL extension implementing Japanese text search";
|
||||
homepage = "https://www.amris.jp/tsja/index.html";
|
||||
maintainers = with maintainers; [ chayleaf ];
|
||||
# GNU-specific linker options are used
|
||||
platforms = platforms.gnu;
|
||||
license = licenses.gpl2Only;
|
||||
};
|
||||
}
|
|
@ -83,5 +83,7 @@ self: super: {
|
|||
|
||||
rum = super.callPackage ./ext/rum.nix { };
|
||||
|
||||
tsja = super.callPackage ./ext/tsja.nix { };
|
||||
|
||||
wal2json = super.callPackage ./ext/wal2json.nix { };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue