Skip to content

Commit becd92c

Browse files
committed
refactor(groonga): move groonga package to pgroonga extension
Remove supabase-groonga from global flake packages and import it locally in pgroonga extension instead. Other components access groonga via pgroonga.passthru.groonga since groonga is only used by pgroonga.
1 parent dd05278 commit becd92c

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

nix/checks.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@
172172
start-postgres-server-bin
173173
which
174174
getkey-script
175-
supabase-groonga
176175
python3
177176
netcat
178177
];
@@ -258,7 +257,7 @@
258257
export HTTP_MOCK_PORT
259258
260259
#First we need to create a generic pg cluster for pgtap tests and run those
261-
export GRN_PLUGINS_DIR=${pkgs.supabase-groonga}/lib/groonga/plugins
260+
export GRN_PLUGINS_DIR=${pgroonga.passthru.groonga}/lib/groonga/plugins
262261
PGTAP_CLUSTER=$(mktemp -d)
263262
log info "Creating temporary PostgreSQL cluster at $PGTAP_CLUSTER"
264263
log_cmd initdb --locale=C --username=supabase_admin -D "$PGTAP_CLUSTER"

nix/ext/pgroonga/default.nix

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
makeWrapper,
1010
xxHash,
1111
buildEnv,
12-
supabase-groonga,
1312
mecab-naist-jdic,
13+
callPackage,
1414
}:
1515
let
16+
# Import groonga locally since it's only used by pgroonga
17+
supabase-groonga = callPackage ./groonga.nix { };
18+
1619
pname = "pgroonga";
1720

1821
# Load version configuration from external file
@@ -171,7 +174,13 @@ buildEnv {
171174
'';
172175

173176
passthru = {
174-
inherit versions numberOfVersions pname;
177+
inherit
178+
versions
179+
numberOfVersions
180+
pname
181+
supabase-groonga
182+
;
183+
groonga = supabase-groonga;
175184
version =
176185
"multi-" + lib.concatStringsSep "-" (map (v: lib.replaceStrings [ "." ] [ "-" ] v) versions);
177186
};

nix/ext/tests/pgroonga.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ self.inputs.nixpkgs.lib.nixos.runTest {
8484
self.packages.${pkgs.system}.mecab-naist-jdic
8585
}/lib/mecab/dic/naist-jdic";
8686
systemd.services.postgresql.environment.MECAB_CONFIG = "${pkgs.mecab}/bin/mecab-config";
87-
systemd.services.postgresql.environment.GRN_PLUGINS_DIR = "${
88-
self.packages.${pkgs.system}.supabase-groonga
89-
}/lib/groonga/plugins";
87+
systemd.services.postgresql.environment.GRN_PLUGINS_DIR =
88+
"${(installedExtension "15").passthru.groonga}/lib/groonga/plugins";
9089

9190
specialisation.postgresql17.configuration = {
9291
services.postgresql = {

nix/overlays/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
postgresql_15
1111
postgresql_17
1212
postgresql_orioledb-17
13-
supabase-groonga
13+
1414
switch-ext-version
1515
mecab-naist-jdic
1616
;

nix/packages/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
github-matrix = pkgs.callPackage ./github-matrix {
3737
nix-eval-jobs = inputs'.nix-eval-jobs.packages.default;
3838
};
39-
supabase-groonga = pkgs.callPackage ../ext/pgroonga/groonga.nix { };
39+
4040
http-mock-server = pkgs.callPackage ./http-mock-server.nix { };
4141
local-infra-bootstrap = pkgs.callPackage ./local-infra-bootstrap.nix { };
4242
mecab-naist-jdic = pkgs.callPackage ./mecab-naist-jdic.nix { };

nix/packages/lib.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
psql_15,
44
psql_orioledb-17,
55
defaults,
6-
supabase-groonga,
76
system,
87
}:
98
{
@@ -15,6 +14,7 @@
1514
extraSubstitutions ? { },
1615
}:
1716
let
17+
supabase-groonga = pgroonga.passthru.groonga or (pkgs.callPackage ../ext/pgroonga/groonga.nix { });
1818
paths = {
1919
migrationsDir = builtins.path {
2020
name = "migrations";

0 commit comments

Comments
 (0)