feat: static page for fun
This commit is contained in:
18
flake.nix
18
flake.nix
@@ -439,20 +439,20 @@
|
||||
};
|
||||
nativeBuildInputs = with prev; [pkg-config curl];
|
||||
};
|
||||
buildHelExt = versionSuffix: let
|
||||
buildHemarExt = versionSuffix: let
|
||||
postgresql = prev."postgresql_${versionSuffix}";
|
||||
c-hectic = self.packages.${prev.system}.c-hectic;
|
||||
in buildPostgresqlExtension {
|
||||
inherit postgresql;
|
||||
} {
|
||||
pname = "hel";
|
||||
pname = "hemar";
|
||||
version = "0.1";
|
||||
src = ./package/c/hel;
|
||||
src = ./package/c/hemar;
|
||||
nativeBuildInputs = (with prev; [pkg-config]) ++ [ c-hectic ];
|
||||
dontShrinkRPath = true;
|
||||
postFixup = ''
|
||||
echo ">>> postFixup running..."
|
||||
${prev.patchelf}/bin/patchelf --set-rpath ${c-hectic}/lib $out/lib/hel.so
|
||||
${prev.patchelf}/bin/patchelf --set-rpath ${c-hectic}/lib $out/lib/hemar.so
|
||||
'';
|
||||
preInstall = ''mkdir $out'';
|
||||
};
|
||||
@@ -462,25 +462,25 @@
|
||||
http = buildHttpExt "17";
|
||||
pg_smtp_client = buildSmtpExt "17";
|
||||
plhaskell = buildPlHaskellExt "17";
|
||||
hel = buildHelExt "17";
|
||||
hemar = buildHemarExt "17";
|
||||
};};
|
||||
postgresql_16 = prev.postgresql_16 // {pkgs = prev.postgresql_16.pkgs // {
|
||||
http = buildHttpExt "16";
|
||||
pg_smtp_client = buildSmtpExt "16";
|
||||
plhaskell = buildPlHaskellExt "16";
|
||||
hel = buildHelExt "16";
|
||||
hemar = buildHemarExt "16";
|
||||
};};
|
||||
postgresql_15 = prev.postgresql_15 // {pkgs = prev.postgresql_15.pkgs // {
|
||||
http = buildHttpExt "15";
|
||||
pg_smtp_client = buildSmtpExt "15";
|
||||
plhaskell = buildPlHaskellExt "15";
|
||||
hel = buildHelExt "15";
|
||||
hemar = buildHemarExt "15";
|
||||
};};
|
||||
postgresql_14 = prev.postgresql_14 // {pkgs = prev.postgresql_14.pkgs // {
|
||||
http = buildHttpExt "14";
|
||||
pg_smtp_client = buildSmtpExt "14";
|
||||
plhaskell = buildPlHaskellExt "14";
|
||||
hel = buildHelExt "14";
|
||||
hemar = buildHemarExt "14";
|
||||
};};
|
||||
writers = let
|
||||
writeC =
|
||||
@@ -560,4 +560,4 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
2
package/c/hemar/.gitignore
vendored
Executable file
2
package/c/hemar/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
hemar.o
|
||||
hemar.so
|
||||
@@ -1,6 +1,6 @@
|
||||
MODULE_big = hel
|
||||
OBJS = hel.o
|
||||
EXTENSION = hel
|
||||
MODULE_big = hemar
|
||||
OBJS = hemar.o
|
||||
EXTENSION = hemar
|
||||
|
||||
DATA = $(wildcard *.sql)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||
\echo Use "CREATE EXTENSION hel" to load this file. \quit
|
||||
\echo Use "CREATE EXTENSION hemar" to load this file. \quit
|
||||
|
||||
CREATE SCHEMA hel;
|
||||
CREATE SCHEMA hemar;
|
||||
|
||||
-- Define the parse_text_with_hectic function that uses hectic library
|
||||
-- Expected usage:
|
||||
-- ```sql
|
||||
-- SELECT "hel"."render"(
|
||||
-- SELECT "hemar"."render"(
|
||||
-- "declare" :=
|
||||
-- jsonb_build_object(
|
||||
-- 'name', 'test',
|
||||
@@ -15,12 +15,12 @@ CREATE SCHEMA hel;
|
||||
-- 'limit', 100
|
||||
-- )
|
||||
-- ),
|
||||
-- "template" := $hel$
|
||||
-- "template" := $hemar$
|
||||
-- {{ name }} {{ config.limit }}
|
||||
-- $hel$
|
||||
-- $hemar$
|
||||
-- );
|
||||
-- ```
|
||||
CREATE FUNCTION "hel"."render"("declare" json, "template" text)
|
||||
CREATE FUNCTION "hemar"."render"("declare" json, "template" text)
|
||||
RETURNS text
|
||||
AS 'hel', 'render'
|
||||
AS 'hemar', 'render'
|
||||
LANGUAGE C STRICT;
|
||||
@@ -9,7 +9,7 @@
|
||||
PG_MODULE_MAGIC;
|
||||
#endif
|
||||
|
||||
/* Helper function to get a JSON value by key path */
|
||||
/* helper function to get a JSON value by key path */
|
||||
static Json *json_get_by_path(Arena *arena, const Json *context, const char *key_path) {
|
||||
|
||||
char *path_copy;
|
||||
@@ -1,3 +1,3 @@
|
||||
comment = 'My first extension'
|
||||
default_version = '0.1'
|
||||
module_pathname = '$libdir/hel'
|
||||
module_pathname = '$libdir/hemar'
|
||||
@@ -93,11 +93,11 @@ case "$MODE" in
|
||||
HECTIC_LIB="$HECTIC_PATH/lib"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
gcc $CFLAGS $OPTFLAGS -I$PG_INCLUDE -I$HECTIC_INCLUDE -shared -o target/hel.so hel.c -L$HECTIC_LIB -lhectic
|
||||
gcc $CFLAGS $OPTFLAGS -I$PG_INCLUDE -I$HECTIC_INCLUDE -shared -o target/hemar.so hemar.c -L$HECTIC_LIB -lhectic
|
||||
|
||||
# Copy extension files to target directory
|
||||
cp hel.control target/
|
||||
cp hel--0.1.sql target/
|
||||
cp hemar.control target/
|
||||
cp hemar--0.1.sql target/
|
||||
|
||||
echo "Build complete. Files available in target/ directory."
|
||||
;;
|
||||
Reference in New Issue
Block a user