File tree Expand file tree Collapse file tree 5 files changed +31
-19
lines changed Expand file tree Collapse file tree 5 files changed +31
-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 275
275
pg_regress = pg_regress ;
276
276
pg_prove = pkgs . perlPackages . TAPParserSourceHandlerpgTAP ;
277
277
mecab_naist_jdic = mecab-naist-jdic ;
278
+ supabase_groonga = supabase-groonga ;
278
279
# Start a version of the server.
279
280
start-server =
280
281
let
288
289
--subst-var-by 'PGSQL_SUPERUSER' '${ pgsqlSuperuser } ' \
289
290
--subst-var-by 'PSQL15_BINDIR' '${ basePackages . psql_15 . bin } ' \
290
291
--subst-var-by 'PSQL_CONF_FILE' '${ configFile } ' \
291
- --subst-var-by 'PGSODIUM_GETKEY' '${ getkeyScript } '
292
+ --subst-var-by 'PGSODIUM_GETKEY' '${ getkeyScript } ' \
293
+ --subst-var-by 'GROONGA_DIR' '${ supabase-groonga } ' \
292
294
293
295
chmod +x $out/bin/start-postgres-server
294
296
'' ;
369
371
let
370
372
sqlTests = ./nix/tests/smoke ;
371
373
pg_prove = pkgs . perlPackages . TAPParserSourceHandlerpgTAP ;
374
+ supabase-groonga = pkgs . callPackage ./nix/supabase-groonga.nix { } ;
372
375
in
373
376
pkgs . runCommand "postgres-${ pgpkg . version } -check-harness"
374
377
{
375
- nativeBuildInputs = with pkgs ; [ coreutils bash pgpkg pg_prove pg_regress procps ] ;
378
+ nativeBuildInputs = with pkgs ; [ coreutils bash pgpkg pg_prove pg_regress procps supabase-groonga ] ;
376
379
} ''
377
380
TMPDIR=$(mktemp -d)
378
381
if [ $? -ne 0 ]; then
390
393
mkdir -p $TMPDIR/logfile
391
394
# Generate a random key and store it in an environment variable
392
395
export PGSODIUM_KEY=$(head -c 32 /dev/urandom | od -A n -t x1 | tr -d ' \n')
393
-
396
+ export GRN_PLUGINS_DIR= ${ supabase-groonga } /lib/groonga/plugins
394
397
# Create a simple script to echo the key
395
398
echo '#!/bin/sh' > $TMPDIR/getkey.sh
396
399
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 @@ -28,6 +28,7 @@ PSQL_CONF_FILE=@PSQL_CONF_FILE@
28
28
PGSODIUM_GETKEY_SCRIPT=@PGSODIUM_GETKEY@
29
29
PORTNO=" ${2:-@ PGSQL_DEFAULT_PORT@ } "
30
30
PLJAVA_LIBJVM_LOCATION=@LIBJVM_LOCATION@
31
+ GROONGA=@GROONGA_DIR@
31
32
DATDIR=$( mktemp -d)
32
33
mkdir -p " $DATDIR "
33
34
@@ -43,5 +44,5 @@ echo "pljava libjvm location: $PLJAVA_LIBJVM_LOCATION"
43
44
sed -e " s#@PGSODIUM_GETKEY_SCRIPT@#$PGSODIUM_GETKEY_SCRIPT #g" \
44
45
-e " s#@PLJAVA_LIBJVM_LOCATION@#$PLJAVA_LIBJVM_LOCATION #g" \
45
46
$PSQL_CONF_FILE > " $DATDIR /postgresql.conf"
46
-
47
+ export GRN_PLUGINS_DIR= $GROONGA /lib/groonga/plugins
47
48
exec postgres -p " $PORTNO " -D " $DATDIR " -k /tmp
You can’t perform that action at this time.
0 commit comments