plugin options

This commit is contained in:
Jeffrey C. Ollie 2023-12-16 20:36:39 -06:00
parent 428be2c33d
commit 522124e8c7
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -123,6 +123,37 @@
};
default = {};
};
plugins = lib.options.mkOption {
type = lib.types.submodule {
options = {
pgvecto-rs = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
description = "Enable pgvecto.rs plugin";
type = lib.types.bool;
default = true;
};
};
};
default = {};
};
postgis = lib.options.mkOption {
type = lib.types.submodule {
options = {
enable = lib.options.mkOption {
description = "Enable postgis plugin";
type = lib.types.bool;
default = true;
};
};
};
default = {};
};
};
};
default = {};
};
replication = lib.options.mkOption {
type = lib.types.submodule {
options = {
@ -366,10 +397,17 @@
escapeShell = value: lib.replaceStrings ["$"] ["\\$"] value;
postgresql = pkgs.postgresql_15.withPackages (
plugins: [
plugins:
(
lib.optionals cfg.plugins.postgis.enable [
plugins.postgis
]
)
++ (
lib.optionals cfg.plugins.pgvecto-rs.enable [
self.packages.${pkgs.system}.pgvecto-rs
]
)
);
# rcloneConfig = pkgs.writeTextFile {
@ -633,7 +671,7 @@
password_encryption = "scram-sha-256";
port = cfg.port;
shared_buffers = "128MB";
shared_preload_libraries = "\"vectors.so\"";
shared_preload_libraries = lib.strings.concatStringsSep "," (lib.optionals cfg.plugins.pgvecto-rs.enable ["vectors.so"]);
ssl = "on";
ssl_cert_file = "/run/credentials/postgresql.service/fullchain.pem";
ssl_key_file = "/run/credentials/postgresql.service/key.pem";