fix?(package): postgreact
This commit is contained in:
15
flake.nix
15
flake.nix
@@ -133,9 +133,10 @@
|
|||||||
pg-migration = pkgs.callPackage ./package/postgres/pg-migration/default.nix rust.commonArgs;
|
pg-migration = pkgs.callPackage ./package/postgres/pg-migration/default.nix rust.commonArgs;
|
||||||
c-hectic = pkgs.callPackage ./package/c/hectic/default.nix {};
|
c-hectic = pkgs.callPackage ./package/c/hectic/default.nix {};
|
||||||
watch = pkgs.callPackage ./package/c/watch/default.nix {};
|
watch = pkgs.callPackage ./package/c/watch/default.nix {};
|
||||||
hmpl = pkgs.callPackage ./package/c/hmpl/default.nix {
|
#hmpl = pkgs.callPackage ./package/c/hmpl/default.nix {
|
||||||
hectic = self.packages.${system}.hectic;
|
# hectic = self.packages.${system}.hectic;
|
||||||
};
|
#};
|
||||||
|
postgreact = pkgs.callPackage ./package/c/postgreact {};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.${system} = let
|
devShells.${system} = let
|
||||||
@@ -467,7 +468,7 @@
|
|||||||
http = buildHttpExt "17";
|
http = buildHttpExt "17";
|
||||||
pg_smtp_client = buildSmtpExt "17";
|
pg_smtp_client = buildSmtpExt "17";
|
||||||
plhaskell = buildPlHaskellExt "15";
|
plhaskell = buildPlHaskellExt "15";
|
||||||
postgreact = prev.callPackage ./package/c/postgreact/default.nix {postgresql = prev.postgresql_17;};
|
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
postgresql_16 =
|
postgresql_16 =
|
||||||
@@ -479,7 +480,7 @@
|
|||||||
http = buildHttpExt "16";
|
http = buildHttpExt "16";
|
||||||
pg_smtp_client = buildSmtpExt "16";
|
pg_smtp_client = buildSmtpExt "16";
|
||||||
plhaskell = buildPlHaskellExt "15";
|
plhaskell = buildPlHaskellExt "15";
|
||||||
postgreact = prev.callPackage ./package/c/postgreact/default.nix {postgresql = prev.postgresql_16;};
|
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
postgresql_15 =
|
postgresql_15 =
|
||||||
@@ -491,7 +492,7 @@
|
|||||||
http = buildHttpExt "15";
|
http = buildHttpExt "15";
|
||||||
pg_smtp_client = buildSmtpExt "15";
|
pg_smtp_client = buildSmtpExt "15";
|
||||||
plhaskell = buildPlHaskellExt "15";
|
plhaskell = buildPlHaskellExt "15";
|
||||||
postgreact = prev.callPackage ./package/c/postgreact/default.nix {postgresql = prev.postgresql_15;};
|
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
postgresql_14 =
|
postgresql_14 =
|
||||||
@@ -503,7 +504,7 @@
|
|||||||
http = buildHttpExt "14";
|
http = buildHttpExt "14";
|
||||||
pg_smtp_client = buildSmtpExt "14";
|
pg_smtp_client = buildSmtpExt "14";
|
||||||
plhaskell = buildPlHaskellExt "15";
|
plhaskell = buildPlHaskellExt "15";
|
||||||
postgreact = prev.callPackage ./package/c/postgreact/default.nix {postgresql = prev.postgresql_14;};
|
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
writers = let
|
writers = let
|
||||||
|
|||||||
16
package/c/postgreact/Makefile
Normal file
16
package/c/postgreact/Makefile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
EXTENSION ?= postgreact
|
||||||
|
EXTENSION_VERSION ?= 1.0
|
||||||
|
|
||||||
|
# INFO(nrv): just in case idk how pgxs Makefile and shit all work
|
||||||
|
EXTVERSION = $(EXTENSION_VERSION)
|
||||||
|
|
||||||
|
MODULE_big = $(EXTENSION)
|
||||||
|
DATA = $(EXTENSION)--$(EXTENSION_VERSION).sql
|
||||||
|
OBJS = $(EXTENSION).o
|
||||||
|
PG_CONFIG = pg_config
|
||||||
|
|
||||||
|
$(BUILD_DIR)/$(EXTENSION).control:
|
||||||
|
sed "s/@EXTENSION_VERSION@/$(EXTVERSION)/g" $(EXTENSION).control.in > $@
|
||||||
|
|
||||||
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||||
|
include $(PGXS)
|
||||||
@@ -1,39 +1,29 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
|
fetchFromGitHub,
|
||||||
|
curl,
|
||||||
postgresql,
|
postgresql,
|
||||||
...
|
buildPostgresqlExtension,
|
||||||
}:
|
}:
|
||||||
stdenv.mkDerivation {
|
buildPostgresqlExtension rec {
|
||||||
pname = "postgreact";
|
pname = "postgreact";
|
||||||
version = "0.1";
|
version = "1.0";
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
];
|
||||||
|
|
||||||
|
EXTENSION = pname;
|
||||||
|
EXTENSION_VERSION = version;
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
buildInputs = [
|
env.NIX_CFLAGS_COMPILE = "-Wno-error";
|
||||||
postgresql
|
|
||||||
];
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
mkdir -p target
|
|
||||||
sh ./make.sh build
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/lib/postgresql $out/share/postgresql/extension
|
|
||||||
|
|
||||||
# Install compiled library
|
|
||||||
install -m 755 -D target/postgreact.so $out/lib/postgresql/postgreact.so
|
|
||||||
|
|
||||||
# Install control and SQL files
|
|
||||||
install -m 644 -D postgreact.control $out/share/postgresql/extension/postgreact.control
|
|
||||||
install -m 644 -D postgreact--0.1.sql $out/share/postgresql/extension/postgreact--0.1.sql
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "PostgreSQL extension for reactive functions";
|
description = "PostgreSQL extension for simple templating.";
|
||||||
homepage = "https://github.com/yukkop/util.nix";
|
homepage = "https://github.com/hectic-lab/util.nix";
|
||||||
license = licenses.mit;
|
license = licenses.asl20;
|
||||||
platforms = postgresql.meta.platforms;
|
platforms = postgresql.meta.platforms;
|
||||||
maintainers = with maintainers; [];
|
maintainers = with maintainers; [];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
# --color Pass -fdiagnostics-color=always to compiler.
|
# --color Pass -fdiagnostics-color=always to compiler.
|
||||||
# help, --help Show this help message.
|
# help, --help Show this help message.
|
||||||
|
|
||||||
|
set -u
|
||||||
|
|
||||||
check_dependencies() {
|
check_dependencies() {
|
||||||
for dep in gcc pg_config; do
|
for dep in gcc pg_config; do
|
||||||
if ! command -v "$dep" >/dev/null 2>&1; then
|
if ! command -v "$dep" >/dev/null 2>&1; then
|
||||||
@@ -91,7 +93,7 @@ case "$MODE" in
|
|||||||
|
|
||||||
# Copy extension files to target directory
|
# Copy extension files to target directory
|
||||||
cp postgreact.control target/
|
cp postgreact.control target/
|
||||||
cp postgreact--0.1.sql target/
|
cp postgreact--${EXTENSION_VERSION}.sql target/
|
||||||
|
|
||||||
echo "Build complete. Files available in target/ directory."
|
echo "Build complete. Files available in target/ directory."
|
||||||
;;
|
;;
|
||||||
@@ -99,4 +101,4 @@ case "$MODE" in
|
|||||||
print_help
|
print_help
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
-- Define the hello function that uses our C implementation
|
-- Define the hello function that uses our C implementation
|
||||||
CREATE FUNCTION hello()
|
CREATE FUNCTION hello()
|
||||||
RETURNS text
|
RETURNS
|
||||||
AS 'postgreact', 'hello'
|
TEXT
|
||||||
LANGUAGE C STRICT;
|
STRICT VOLATILE
|
||||||
|
LANGUAGE C
|
||||||
|
AS
|
||||||
|
'MODULE_PATHNAME', 'hello'
|
||||||
|
;
|
||||||
@@ -6,11 +6,15 @@
|
|||||||
PG_MODULE_MAGIC;
|
PG_MODULE_MAGIC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define the function hello */
|
|
||||||
PG_FUNCTION_INFO_V1(hello);
|
|
||||||
|
|
||||||
/* Implement the function */
|
|
||||||
Datum hello(PG_FUNCTION_ARGS)
|
Datum hello(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
PG_RETURN_TEXT_P(cstring_to_text("Hello, world!"));
|
PG_RETURN_TEXT_P(cstring_to_text("Eblan!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _PG_init(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
void _PG_fini(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
comment = 'My first extension'
|
|
||||||
default_version = '1.0'
|
|
||||||
module_pathname = $libdir/postgreact
|
|
||||||
relocatable = true
|
|
||||||
4
package/c/postgreact/postgreact.control.in
Normal file
4
package/c/postgreact/postgreact.control.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
comment = 'My first extension'
|
||||||
|
default_version = '@EXTENSION_VERSION@'
|
||||||
|
module_pathname = '$libdir/postgreact'
|
||||||
|
relocatable = false
|
||||||
11
package/c/postgreact/postgreact.h
Normal file
11
package/c/postgreact/postgreact.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include "postgres.h"
|
||||||
|
|
||||||
|
#ifdef PG_MODULE_MAGIC
|
||||||
|
PG_MODULE_MAGIC;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void _PG_init(void);
|
||||||
|
void _PG_fini(void);
|
||||||
|
|
||||||
|
Datum hello(PG_FUNCTION_ARGS);
|
||||||
|
PG_FUNCTION_INFO_V1(hello);
|
||||||
Reference in New Issue
Block a user