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