fix?(package): postgreact: ~stir the stupid shit till it works [3]
This commit is contained in:
26
flake.nix
26
flake.nix
@@ -136,7 +136,7 @@
|
||||
#hmpl = pkgs.callPackage ./package/c/hmpl/default.nix {
|
||||
# hectic = self.packages.${system}.hectic;
|
||||
#};
|
||||
#postgreact = pkgs.callPackage ./package/c/postgreact {};
|
||||
postgreact = pkgs.callPackage ./package/c/postgreact {};
|
||||
};
|
||||
|
||||
devShells.${system} = let
|
||||
@@ -457,22 +457,6 @@
|
||||
};
|
||||
nativeBuildInputs = with prev; [pkg-config curl];
|
||||
};
|
||||
buildPostgreactExt = versionSuffix:
|
||||
buildPostgresqlExtension {
|
||||
postgresql = prev."postgresql_${versionSuffix}";
|
||||
} (rec {
|
||||
pname = "postgreact";
|
||||
version = "1.0";
|
||||
src = ./package/c/${pname};
|
||||
nativeBuildInputs = with prev; [pkg-config]; # ???
|
||||
meta = with lib; {
|
||||
description = "PostgreSQL extension for simple templating.";
|
||||
homepage = "https://github.com/hectic-lab/util.nix";
|
||||
license = licenses.asl20;
|
||||
platforms = postgresql.meta.platforms;
|
||||
maintainers = with maintainers; [];
|
||||
};
|
||||
});
|
||||
in {
|
||||
hectic = self.packages.${prev.system};
|
||||
postgresql_17 =
|
||||
@@ -484,7 +468,7 @@
|
||||
http = buildHttpExt "17";
|
||||
pg_smtp_client = buildSmtpExt "17";
|
||||
plhaskell = buildPlHaskellExt "15";
|
||||
postgreact = buildPostgreactExt "17";
|
||||
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||
};
|
||||
};
|
||||
postgresql_16 =
|
||||
@@ -496,7 +480,7 @@
|
||||
http = buildHttpExt "16";
|
||||
pg_smtp_client = buildSmtpExt "16";
|
||||
plhaskell = buildPlHaskellExt "15";
|
||||
postgreact = buildPostgreactExt "16";
|
||||
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||
};
|
||||
};
|
||||
postgresql_15 =
|
||||
@@ -508,7 +492,7 @@
|
||||
http = buildHttpExt "15";
|
||||
pg_smtp_client = buildSmtpExt "15";
|
||||
plhaskell = buildPlHaskellExt "15";
|
||||
postgreact = buildPostgreactExt "15";
|
||||
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||
};
|
||||
};
|
||||
postgresql_14 =
|
||||
@@ -520,7 +504,7 @@
|
||||
http = buildHttpExt "14";
|
||||
pg_smtp_client = buildSmtpExt "14";
|
||||
plhaskell = buildPlHaskellExt "15";
|
||||
postgreact = buildPostgreactExt "15";
|
||||
postgreact = self.packages.${prev.system}.postgreact.override {postgresql = prev.postgresql_17;};
|
||||
};
|
||||
};
|
||||
writers = let
|
||||
|
||||
3
package/c/postgreact/.gitignore
vendored
Normal file
3
package/c/postgreact/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
package/c/postgreact/postgreact.control
|
||||
package/c/postgreact/postgreact.o
|
||||
package/c/postgreact/postgreact.so
|
||||
@@ -1,16 +1,18 @@
|
||||
EXTENSION ?= postgreact
|
||||
EXTENSION_VERSION ?= 1.0
|
||||
|
||||
# INFO(nrv): just in case idk how pgxs Makefile and shit all work
|
||||
EXTVERSION = $(EXTENSION_VERSION)
|
||||
EXTENSION_COMMENT ?= My first extension
|
||||
|
||||
MODULE_big = $(EXTENSION)
|
||||
DATA = $(EXTENSION)--$(EXTENSION_VERSION).sql
|
||||
DATA = $(EXTENSION)--$(EXTENSION_VERSION).sql $(EXTENSION).control
|
||||
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)
|
||||
|
||||
.PHONY: $(EXTENSION).control
|
||||
|
||||
$(EXTENSION).control:
|
||||
sed "s/@EXTENSION_VERSION@/$(EXTENSION_VERSION)/g; s/@EXTENSION_COMMENT@/$(EXTENSION_COMMENT)/g; s/@EXTENSION@/$(EXTENSION)/g" $(EXTENSION).control.in > $@
|
||||
|
||||
include $(PGXS)
|
||||
|
||||
# vim:wrap
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
{
|
||||
lib,
|
||||
}: {
|
||||
stdenv,
|
||||
postgresql,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "postgreact";
|
||||
version = "1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
USE_PGXS = 1;
|
||||
EXTENSION = pname;
|
||||
EXTENSION_VERSION = version;
|
||||
EXTENSION_COMMENT = meta.description;
|
||||
|
||||
buildInputs = [
|
||||
postgresql
|
||||
];
|
||||
|
||||
buildPhase = ''make all'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/postgresql $out/share/postgresql/extension
|
||||
|
||||
# Install compiled library
|
||||
install -m 755 -D 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--${EXTENSION_VERSION}.sql $out/share/postgresql/extension/postgreact--${EXTENSION_VERSION}.sql
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "PostgreSQL extension for simple templating.";
|
||||
homepage = "https://github.com/yukkop/util.nix";
|
||||
license = licenses.asl20;
|
||||
platforms = postgresql.meta.platforms;
|
||||
maintainers = with maintainers; [];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#include "postgres.h"
|
||||
#include "fmgr.h"
|
||||
#include "utils/builtins.h" /* for text_to_cstring and cstring_to_text */
|
||||
#include "postgreact.h"
|
||||
|
||||
#ifdef PG_MODULE_MAGIC
|
||||
PG_MODULE_MAGIC;
|
||||
#endif
|
||||
|
||||
Datum hello(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Datum hello(PG_FUNCTION_ARGS) {
|
||||
PG_RETURN_TEXT_P(cstring_to_text("Eblan!"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
comment = 'My first extension'
|
||||
comment = '@EXTENSION_COMMENT@'
|
||||
default_version = '@EXTENSION_VERSION@'
|
||||
module_pathname = '$libdir/postgreact'
|
||||
module_pathname = '$libdir/@EXTENSION@'
|
||||
relocatable = false
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef POSTGREACT_H
|
||||
#define POSTGREACT_H
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#ifdef PG_MODULE_MAGIC
|
||||
@@ -9,3 +12,5 @@ void _PG_fini(void);
|
||||
|
||||
Datum hello(PG_FUNCTION_ARGS);
|
||||
PG_FUNCTION_INFO_V1(hello);
|
||||
|
||||
#endif // POSTGREACT_H
|
||||
|
||||
Reference in New Issue
Block a user