2024-11-02 22:04:45 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
makeTest,
|
2024-11-01 18:49:55 +00:00
|
|
|
}:
|
2023-10-20 07:41:34 +00:00
|
|
|
|
2024-11-01 18:49:55 +00:00
|
|
|
let
|
2024-11-02 20:24:48 +00:00
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
2024-11-02 22:04:45 +00:00
|
|
|
makeTestFor =
|
|
|
|
package:
|
2024-11-01 18:49:55 +00:00
|
|
|
makeTest {
|
2024-11-02 20:24:48 +00:00
|
|
|
name = "tsja-${package.name}";
|
2024-11-01 18:49:55 +00:00
|
|
|
meta = {
|
|
|
|
maintainers = with lib.maintainers; [ chayleaf ];
|
2023-10-20 07:41:34 +00:00
|
|
|
};
|
|
|
|
|
2024-11-02 22:04:45 +00:00
|
|
|
nodes.master =
|
|
|
|
{ ... }:
|
2024-11-02 20:24:48 +00:00
|
|
|
{
|
|
|
|
services.postgresql = {
|
|
|
|
inherit package;
|
|
|
|
enable = true;
|
2024-11-12 20:02:10 +00:00
|
|
|
enableJIT = lib.hasInfix "-jit-" package.name;
|
2024-11-11 22:23:46 +00:00
|
|
|
extensions =
|
2024-11-02 22:04:45 +00:00
|
|
|
ps: with ps; [
|
|
|
|
tsja
|
|
|
|
];
|
2024-11-01 18:49:55 +00:00
|
|
|
};
|
2024-11-02 20:24:48 +00:00
|
|
|
};
|
2024-11-01 18:49:55 +00:00
|
|
|
|
|
|
|
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 "{日本語}"
|
|
|
|
""")
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
2024-11-02 20:24:48 +00:00
|
|
|
lib.recurseIntoAttrs (
|
2024-11-02 22:04:45 +00:00
|
|
|
lib.concatMapAttrs (n: p: { ${n} = makeTestFor p; }) (
|
|
|
|
lib.filterAttrs (_: p: !p.pkgs.tsja.meta.broken) pkgs.postgresqlVersions
|
|
|
|
)
|
2024-11-02 17:58:52 +00:00
|
|
|
// {
|
2024-11-02 20:24:48 +00:00
|
|
|
passthru.override = p: makeTestFor p;
|
2024-11-02 17:58:52 +00:00
|
|
|
}
|
|
|
|
)
|