Skip to content

Commit

Permalink
Extend nix modules for new config options
Browse files Browse the repository at this point in the history
  • Loading branch information
eikek committed Mar 21, 2022
1 parent 5de6c89 commit f0b652d
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nix/configuration-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ let
full-text-search = {
enabled = true;
solr.url = "http://localhost:${toString config.services.solr.port}/solr/docspell";
postgresql = {
pg-config = {
"german" = "my-germam";
};
};
};
in
{
Expand Down
73 changes: 73 additions & 0 deletions nix/module-joex.nix
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,25 @@ Docpell Update Check
};
full-text-search = {
enabled = false;
backend = "solr";
solr = {
url = "http://localhost:8983/solr/docspell";
commit-within = 1000;
log-verbose = false;
def-type = "lucene";
q-op = "OR";
};
postgresql = {
use-default-connection = false;
jdbc = {
url = "jdbc:postgresql://server:5432/db";
user = "pguser";
password = "";
};
pg-config = {};
pg-query-parser = "websearch_to_tsquery";
pg-rank-normalization = [ 4 ];
};
migration = {
index-all-chunk = 10;
};
Expand Down Expand Up @@ -1371,6 +1383,12 @@ in {
Currently the SOLR search platform is supported.
'';
};
backend = mkOption {
type = types.str;
default = defaults.full-text-search.backend;
description = "The backend to use, either solr or postgresql";
};

solr = mkOption {
type = types.submodule({
options = {
Expand Down Expand Up @@ -1408,6 +1426,61 @@ in {
default = defaults.full-text-search.solr;
description = "Configuration for the SOLR backend.";
};

postgresql = mkOption {
type = types.submodule({
options = {
use-default-connection = mkOption {
type = types.bool;
default = defaults.full-text-search.postgresql.use-default-connection;
description = "Whether to use the primary db connection.";
};
jdbc = mkOption {
type = types.submodule ({
options = {
url = mkOption {
type = types.str;
default = defaults.jdbc.url;
description = ''
The URL to the database.
'';
};
user = mkOption {
type = types.str;
default = defaults.jdbc.user;
description = "The user name to connect to the database.";
};
password = mkOption {
type = types.str;
default = defaults.jdbc.password;
description = "The password to connect to the database.";
};
};
});
default = defaults.full-text-search.postgresql.jdbc;
description = "Database connection settings";
};
pg-config = mkOption {
type = types.attrs;
default = defaults.full-text-search.postgresql.pg-config;
description = "";
};
pg-query-parser = mkOption {
type = types.str;
default = defaults.full-text-search.postgresql.pg-query-parser;
description = "";
};
pg-rank-normalization = mkOption {
type = types.listOf types.int;
default = defaults.full-text-search.postgresql.pg-rank-normalization;
description = "";
};
};
});
default = defaults.full-text-search.postgresql;
description = "PostgreSQL for fulltext search";
};

migration = mkOption {
type = types.submodule({
options = {
Expand Down
65 changes: 65 additions & 0 deletions nix/module-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ let
def-type = "lucene";
q-op = "OR";
};
postgresql = {
use-default-connection = false;
jdbc = {
url = "jdbc:postgresql://server:5432/db";
user = "pguser";
password = "";
};
pg-config = {};
pg-query-parser = "websearch_to_tsquery";
pg-rank-normalization = [ 4 ];
};
};
auth = {
server-secret = "hex:caffee";
Expand Down Expand Up @@ -575,6 +586,60 @@ in {
default = defaults.full-text-search.solr;
description = "Configuration for the SOLR backend.";
};

postgresql = mkOption {
type = types.submodule({
options = {
use-default-connection = mkOption {
type = types.bool;
default = defaults.full-text-search.postgresql.use-default-connection;
description = "Whether to use the primary db connection.";
};
jdbc = mkOption {
type = types.submodule ({
options = {
url = mkOption {
type = types.str;
default = defaults.jdbc.url;
description = ''
The URL to the database.
'';
};
user = mkOption {
type = types.str;
default = defaults.jdbc.user;
description = "The user name to connect to the database.";
};
password = mkOption {
type = types.str;
default = defaults.jdbc.password;
description = "The password to connect to the database.";
};
};
});
default = defaults.full-text-search.postgresql.jdbc;
description = "Database connection settings";
};
pg-config = mkOption {
type = types.attrs;
default = defaults.full-text-search.postgresql.pg-config;
description = "";
};
pg-query-parser = mkOption {
type = types.str;
default = defaults.full-text-search.postgresql.pg-query-parser;
description = "";
};
pg-rank-normalization = mkOption {
type = types.listOf types.int;
default = defaults.full-text-search.postgresql.pg-rank-normalization;
description = "";
};
};
});
default = defaults.full-text-search.postgresql;
description = "PostgreSQL for fulltext search";
};
};
});
default = defaults.full-text-search;
Expand Down

0 comments on commit f0b652d

Please sign in to comment.