Skip to content

Commit

Permalink
feat: working orioledb-17
Browse files Browse the repository at this point in the history
  • Loading branch information
samrose committed Oct 25, 2024
1 parent fa05170 commit 0e283e6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
8 changes: 6 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@
x != ./nix/ext/pgvector.nix &&
x != ./nix/ext/plv8.nix &&
x != ./nix/ext/postgis.nix &&
x != ./nix/ext/pgrouting.nix
x != ./nix/ext/pgrouting.nix &&
x != ./nix/ext/pg_jsonschema.nix &&
x != ./nix/ext/pg_graphql.nix &&
x != ./nix/ext/rum.nix &&
x != ./nix/ext/wal2json.nix
) ourExtensions;

orioledbExtensions = orioleFilteredExtensions ++ [ ./nix/ext/orioledb.nix ];
Expand Down Expand Up @@ -466,7 +470,7 @@
--subst-var-by 'PGSQL_SUPERUSER' '${pgsqlSuperuser}' \
--subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}' \
--subst-var-by 'PSQL16_BINDIR' '${basePackages.psql_16.bin}' \
--subst-var-by 'PSQLORIOLEDB16_BINDIR' '${basePackages.psql_orioledb-16.bin}' \
--subst-var-by 'PSQLORIOLEDB17_BINDIR' '${basePackages.psql_orioledb-17.bin}' \
--subst-var-by 'MIGRATIONS_DIR' '${migrationsDir}' \
--subst-var-by 'POSTGRESQL_SCHEMA_SQL' '${postgresqlSchemaSql}' \
--subst-var-by 'PGBOUNCER_AUTH_SCHEMA_SQL' '${pgbouncerAuthSchemaSql}' \
Expand Down
4 changes: 2 additions & 2 deletions nix/ext/orioledb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ stdenv.mkDerivation rec {
owner = "orioledb";
repo = "orioledb";
rev = "2861cf9091a92bcabbbbf1f4d15f8edff480fea1";
sha256 = "";
sha256 = "sha256-VVOHOIhQSQ824vfZlptOj1Gcu6Jg80amjRp7CpUOq6s=";
};
version = "patches17_3";
buildInputs = [ curl libkrb5 postgresql python3 openssl ];
buildPhase = "make USE_PGXS=1 ORIOLEDB_PATCHSET_VERSION=31";
buildPhase = "make USE_PGXS=1 ORIOLEDB_PATCHSET_VERSION=3";
installPhase = ''
runHook preInstall
mkdir -p $out/{lib,share/postgresql/extension}
Expand Down
4 changes: 4 additions & 0 deletions nix/ext/pgaudit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#adapted from https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/sql/postgresql/ext/pgaudit.nix
let
source = {
"17" = {
version = "17.0";
hash = "sha256-3ksq09wiudQPuBQI3dhEQi8IkXKLVIsPFgBnwLiicro=";
};
"16" = {
version = "16.0";
hash = "sha256-8+tGOl1U5y9Zgu+9O5UDDE4bec4B0JC/BQ6GLhHzQzc=";
Expand Down
12 changes: 6 additions & 6 deletions nix/postgresql/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let
inherit version;
pname = pname + lib.optionalString jitSupport "-jit";

src = if (builtins.match "17_*" version != null) then
src = if (builtins.match "[0-9][0-9]_.*" version != null) then
fetchurl {
url = "https://github.com/orioledb/postgres/archive/refs/tags/patches${version}.tar.gz";
inherit hash;
Expand All @@ -64,7 +64,7 @@ let

hardeningEnable = lib.optionals (!stdenv'.cc.isClang) [ "pie" ];

outputs = [ "out" "lib" "doc" "man" ];
outputs = [ "out" "lib" ];
setOutputFlags = false; # $out retains configureFlags :-/

buildInputs = [
Expand All @@ -83,7 +83,7 @@ let
++ lib.optionals gssSupport [ libkrb5 ]
++ lib.optionals stdenv'.isLinux [ linux-pam ]
++ lib.optionals (!stdenv'.isDarwin) [ libossp_uuid ]
++ lib.optionals (builtins.match "16_.*" version != null) [
++ lib.optionals (builtins.match "[0-9][0-9]_.*" version != null) [
perl bison flex docbook_xsl docbook_xml_dtd_45 docbook_xsl_ns libxslt
];

Expand All @@ -97,7 +97,7 @@ let

separateDebugInfo = true;

buildFlags = [ "world" ];
buildFlags = [ "world-bin" ];

# Makes cross-compiling work when xml2-config can't be executed on the host.
# Fixed upstream in https://github.com/postgres/postgres/commit/0bc8cebdb889368abdf224aeac8bc197fe4c9ae6
Expand Down Expand Up @@ -138,7 +138,7 @@ let
(if atLeast "13" then ./patches/socketdir-in-run-13+.patch else ./patches/socketdir-in-run.patch)
];

installTargets = [ "install-world" ];
installTargets = [ "install-world-bin" ];

postPatch = ''
# Hardcode the path to pgxs so pg_config returns the path in $out
Expand Down Expand Up @@ -288,7 +288,7 @@ let
paths = f pkgs ++ [
postgresql
postgresql.lib
postgresql.man # in case user installs this into environment
#TODO RM postgresql.man # in case user installs this into environment
];
nativeBuildInputs = [ makeWrapper ];

Expand Down
2 changes: 1 addition & 1 deletion nix/postgresql/orioledb-17.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./generic.nix {
version = "17_3";
hash = "";
hash = "sha256-LOlST80eU+Wmmcmo4WHGwOClYZ+bBahyltsGYeKWCU4=";
}
2 changes: 2 additions & 0 deletions nix/tools/run-server.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ remove_config_items() {
if [ "$1" == "orioledb-17" ]; then
# Remove items from postgresql.conf
sed -i 's/ timescaledb,//g;' "$DATDIR/postgresql.conf"
#as of pg 16.4 + this db_user_namespace totally deprecated and will break the server if setting is present
sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "$DATDIR/postgresql.conf"
sed -i 's/ timescaledb,//g; s/ vector,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "$DATDIR/supautils.conf"
fi
}
Expand Down

0 comments on commit 0e283e6

Please sign in to comment.