Skip to content

Commit a0dbf97

Browse files
samrosesoedirgo
authored andcommitted
feat: tmp disable pg_net on macos and allow for server start on macos (#1289)
Co-authored-by: Sam Rose <[email protected]>
1 parent dba952b commit a0dbf97

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

flake.nix

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
# use, but even if they did, keeping our own copies means that we can
105105
# rollout new versions of these critical things easier without having to
106106
# go through the upstream release engineering process.
107-
ourExtensions = [
107+
ourExtensions = let
108+
baseExtensions = [
108109
./nix/ext/rum.nix
109110
./nix/ext/timescaledb.nix
110111
./nix/ext/timescaledb-2.9.1.nix
@@ -123,7 +124,6 @@
123124
./nix/ext/pg_cron.nix
124125
./nix/ext/pgsql-http.nix
125126
./nix/ext/pg_plan_filter.nix
126-
./nix/ext/pg_net.nix
127127
./nix/ext/pg_hashids.nix
128128
./nix/ext/pgsodium.nix
129129
./nix/ext/pg_graphql.nix
@@ -137,7 +137,13 @@
137137
./nix/ext/supautils.nix
138138
./nix/ext/plv8.nix
139139
];
140+
141+
# Add pg_net only if NOT on macOS aarch64
142+
pgNetExtension = if (system == "aarch64-darwin")
143+
then []
144+
else [ ./nix/ext/pg_net.nix ];
140145

146+
in baseExtensions ++ pgNetExtension;
141147
#Where we import and build the orioledb extension, we add on our custom extensions
142148
# plus the orioledb option
143149
orioledbExtension = ourExtensions ++ [ ./nix/ext/orioledb.nix ];
@@ -384,7 +390,8 @@
384390
--subst-var-by 'LOCALES' '${localeArchive}' \
385391
--subst-var-by 'EXTENSION_CUSTOM_SCRIPTS_DIR' "$out/extension-custom-scripts" \
386392
--subst-var-by 'MECAB_LIB' '${basePackages.psql_15.exts.pgroonga}/lib/groonga/plugins/tokenizers/tokenizer_mecab.so' \
387-
--subst-var-by 'GROONGA_DIR' '${supabase-groonga}'
393+
--subst-var-by 'GROONGA_DIR' '${supabase-groonga}' \
394+
--subst-var-by 'CURRENT_SYSTEM' '${system}'
388395
389396
chmod +x $out/bin/start-postgres-server
390397
'';

nix/tools/run-server.sh.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ EXTENSION_CUSTOM_SCRIPTS=@EXTENSION_CUSTOM_SCRIPTS_DIR@
3232
GROONGA=@GROONGA_DIR@
3333
DATDIR=$(mktemp -d)
3434
LOCALE_ARCHIVE=@LOCALES@
35+
CURRENT_SYSTEM=@CURRENT_SYSTEM@
3536
export LOCALE_ARCHIVE
3637
export LANG=en_US.UTF-8
3738
export LANGUAGE=en_US.UTF-8
3839
export LC_ALL=en_US.UTF-8
3940
export LANG=en_US.UTF-8
4041
export LC_CTYPE=en_US.UTF-8
42+
echo "Current system is $CURRENT_SYSTEM"
4143
mkdir -p "$DATDIR"
4244
echo "NOTE: using port $PORTNO for server"
4345
echo "NOTE: using temporary directory $DATDIR for data, which will not be removed"
@@ -61,5 +63,10 @@ pgsodium.getkey_script = '$PGSODIUM_GETKEY_SCRIPT'" \
6163
-e "\$a\\
6264
session_preload_libraries = 'supautils'" \
6365
"$PSQL_CONF_FILE" > "$DATDIR/postgresql.conf"
66+
if [ "$CURRENT_SYSTEM" = "aarch64-darwin" ]; then
67+
echo "NOTE: using aarch64-darwin system"
68+
sed -i '' 's/ pg_net,//g' "$DATDIR/postgresql.conf"
69+
sed -i '' 's/ pg_net,//g' "$DATDIR/supautils.conf"
70+
fi
6471
export GRN_PLUGINS_DIR=$GROONGA/lib/groonga/plugins
6572
postgres --config-file="$DATDIR/postgresql.conf" -p "$PORTNO" -D "$DATDIR" -k /tmp

0 commit comments

Comments
 (0)