File tree Expand file tree Collapse file tree 5 files changed +32
-19
lines changed Expand file tree Collapse file tree 5 files changed +32
-19
lines changed Original file line number Diff line number Diff line change 13
13
- name : Install pg_prove from nix binary cache
14
14
become : yes
15
15
shell : |
16
- sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/sam/2-stage-ami-nix#pg_prove"
16
+ sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#pg_prove"
17
+ when : stage2_nix
18
+
19
+ - name : Install supabase-groonga from nix binary cache
20
+ become : yes
21
+ shell : |
22
+ sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#supabase-groonga"
17
23
when : stage2_nix
18
24
19
25
- name : Set ownership and permissions for /etc/ssl/private
220
226
# script is expected to be placed by finalization tasks for different target platforms
221
227
line : pgsodium.getkey_script= '{{ pg_bindir }}/pgsodium_getkey.sh'
222
228
when : stage2_nix
229
+
230
+ - name : Append GRN_PLUGINS_DIR to /etc/environment.d/postgresql.env
231
+ ansible.builtin.lineinfile :
232
+ path : /etc/environment.d/postgresql.env
233
+ line : ' GRN_PLUGINS_DIR=/var/lib/postgresql/.nix-profile/lib/groonga/plugins'
234
+ become : yes
Original file line number Diff line number Diff line change 318
318
} ;
319
319
} ;
320
320
mecab_naist_jdic = mecab-naist-jdic ;
321
+ supabase_groonga = supabase-groonga ;
321
322
# Start a version of the server.
322
323
start-server =
323
324
let
381
382
--subst-var-by 'PG_IDENT' "$out/etc/postgresql/pg_ident.conf" \
382
383
--subst-var-by 'LOCALES' '${ localeArchive } ' \
383
384
--subst-var-by 'EXTENSION_CUSTOM_SCRIPTS_DIR' "$out/extension-custom-scripts" \
384
- --subst-var-by 'MECAB_LIB' '${ basePackages . psql_15 . exts . pgroonga } /lib/groonga/plugins/tokenizers/tokenizer_mecab.so'
385
+ --subst-var-by 'MECAB_LIB' '${ basePackages . psql_15 . exts . pgroonga } /lib/groonga/plugins/tokenizers/tokenizer_mecab.so' \
386
+ --subst-var-by 'GROONGA_DIR' '${ supabase-groonga } '
385
387
386
388
chmod +x $out/bin/start-postgres-server
387
389
'' ;
452
454
let
453
455
sqlTests = ./nix/tests/smoke ;
454
456
pg_prove = pkgs . perlPackages . TAPParserSourceHandlerpgTAP ;
457
+ supabase-groonga = pkgs . callPackage ./nix/supabase-groonga.nix { } ;
455
458
in
456
459
pkgs . runCommand "postgres-${ pgpkg . version } -check-harness"
457
460
{
458
- nativeBuildInputs = with pkgs ; [ coreutils bash pgpkg pg_prove pg_regress procps ] ;
461
+ nativeBuildInputs = with pkgs ; [ coreutils bash pgpkg pg_prove pg_regress procps supabase-groonga ] ;
459
462
} ''
460
463
TMPDIR=$(mktemp -d)
461
464
if [ $? -ne 0 ]; then
473
476
mkdir -p $TMPDIR/logfile
474
477
# Generate a random key and store it in an environment variable
475
478
export PGSODIUM_KEY=$(head -c 32 /dev/urandom | od -A n -t x1 | tr -d ' \n')
476
-
479
+ export GRN_PLUGINS_DIR= ${ supabase-groonga } /lib/groonga/plugins
477
480
# Create a simple script to echo the key
478
481
echo '#!/bin/sh' > $TMPDIR/getkey.sh
479
482
echo 'echo $PGSODIUM_KEY' >> $TMPDIR/getkey.sh
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
11
11
} ;
12
12
nativeBuildInputs = [ pkg-config makeWrapper ] ;
13
13
buildInputs = [ postgresql msgpack-c supabase-groonga mecab ] ;
14
-
14
+ propagatedBuildInputs = [ supabase-groonga ] ;
15
15
configureFlags = [
16
16
"--with-mecab=${ mecab } "
17
17
"--enable-mecab"
@@ -40,19 +40,6 @@ stdenv.mkDerivation rec {
40
40
install -D pgroonga_database.control -t $out/share/postgresql/extension
41
41
install -D data/pgroonga_database-*.sql -t $out/share/postgresql/extension
42
42
43
- # Modify the main PGroonga SQL file to include MeCab plugin registration
44
- for sql_file in $out/share/postgresql/extension/pgroonga-*.sql; do
45
- echo "SELECT pgroonga_command('plugin_register ${ supabase-groonga } /lib/groonga/plugins/tokenizers/mecab.so');" >> $sql_file
46
- done
47
-
48
- cat << EOF > $out/share/postgresql/extension/pgroonga_set_paths.sql
49
- DO \$\$
50
- BEGIN
51
- SET pgroonga.log_path TO current_setting('data_directory') || '/groonga.log';
52
- END \$\$;
53
- EOF
54
- chmod +x $out/share/postgresql/extension/pgroonga_set_paths.sql
55
-
56
43
makeWrapper ${ postgresql } /bin/postgres $out/bin/pgroonga-postgres \
57
44
--set LD_LIBRARY_PATH "${ lib . makeLibraryPath buildInputs } :${ supabase-groonga } /lib:$out/lib"
58
45
Original file line number Diff line number Diff line change @@ -37,6 +37,15 @@ in stdenv.mkDerivation (finalAttrs: {
37
37
echo "CMake cache contents related to MeCab:"
38
38
grep -i mecab CMakeCache.txt
39
39
'' ;
40
+
41
+ # installPhase = ''
42
+ # mkdir -p $out/bin $out/lib/groonga/plugins
43
+ # cp -r lib/groonga/plugins/* $out/lib/groonga/plugins
44
+ # cp -r bin/* $out/bin
45
+ # echo "Installed Groonga plugins:"
46
+ # ls -l $out/lib/groonga/plugins
47
+ # '';
48
+
40
49
postInstall = ''
41
50
echo "Searching for MeCab-related files:"
42
51
find $out -name "*mecab*"
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ READREPL_CONFIG_FILE=@READREPL_CONF_FILE@
29
29
PG_HBA_FILE=@PG_HBA@
30
30
PG_IDENT_FILE=@PG_IDENT@
31
31
EXTENSION_CUSTOM_SCRIPTS=@EXTENSION_CUSTOM_SCRIPTS_DIR@
32
+ GROONGA=@GROONGA_DIR@
32
33
DATDIR=$( mktemp -d)
33
34
LOCALE_ARCHIVE=@LOCALES@
34
35
export LOCALE_ARCHIVE
@@ -60,4 +61,5 @@ pgsodium.getkey_script = '$PGSODIUM_GETKEY_SCRIPT'" \
60
61
-e " \$ a\\
61
62
session_preload_libraries = 'supautils'" \
62
63
" $PSQL_CONF_FILE " > " $DATDIR /postgresql.conf"
63
- postgres --config-file=" $DATDIR /postgresql.conf" -p " $PORTNO " -D " $DATDIR " -k /tmp
64
+ export GRN_PLUGINS_DIR=$GROONGA /lib/groonga/plugins
65
+ postgres --config-file=" $DATDIR /postgresql.conf" -p " $PORTNO " -D " $DATDIR " -k /tmp
You can’t perform that action at this time.
0 commit comments