Add nix options for addons

This commit is contained in:
eikek
2022-05-21 22:02:42 +02:00
parent 86d026cd63
commit b84881c083
3 changed files with 191 additions and 6 deletions

View File

@ -46,6 +46,9 @@ in
services.docspell-restserver = { services.docspell-restserver = {
enable = true; enable = true;
bind.address = "0.0.0.0"; bind.address = "0.0.0.0";
backend = {
addons.enabled = true;
};
integration-endpoint = { integration-endpoint = {
enabled = true; enabled = true;
http-header = { http-header = {
@ -60,8 +63,8 @@ in
provider-id = "local"; provider-id = "local";
client-id = "cid1"; client-id = "cid1";
client-secret = "csecret-1"; client-secret = "csecret-1";
authorize-url = "http:auth"; authorize-url = "http://auth";
token-url = "http:token"; token-url = "http://token";
sign-key = "b64:uiaeuae"; sign-key = "b64:uiaeuae";
}; };
} }

View File

@ -19,6 +19,12 @@ let
logging = { logging = {
minimum-level = "Info"; minimum-level = "Info";
format = "Fancy"; format = "Fancy";
levels = {
"docspell" = "Info";
"org.flywaydb" = "Info";
"binny" = "Info";
"org.http4s" = "Info";
};
}; };
mail-debug = false; mail-debug = false;
jdbc = { jdbc = {
@ -240,6 +246,29 @@ Docpell Update Check
index-all-chunk = 10; index-all-chunk = 10;
}; };
}; };
addons = {
working-dir = "/tmp/docspell-addons-work";
cache-dir = "/tmp/docspell-addons-cache";
executor-config = {
runner = "nix-flake,docker,trivial";
nspawn = {
enabled = false;
sudo-binary = "sudo";
nspawn-binary = "systemd-nspawn";
container-wait = "100 millis";
};
fail-fast = true;
run-timeout = "15 minutes";
nix-runner = {
nix-binary = "${pkgs.nix}/bin/nix";
build-timeout = "15 minutes";
};
docker-runner = {
docker-binary = "${pkgs.docker}/bin/docker";
build-timeout = "15 minutes";
};
};
};
}; };
in { in {
@ -320,6 +349,11 @@ in {
default = defaults.logging.format; default = defaults.logging.format;
description = "The log format. One of: Fancy, Plain, Json or Logfmt"; description = "The log format. One of: Fancy, Plain, Json or Logfmt";
}; };
levels = mkOption {
type = types.attrs;
default = defaults.logging.levels;
description = "Set of logger and their levels";
};
}; };
}); });
default = defaults.logging; default = defaults.logging;
@ -1527,6 +1561,111 @@ in {
default = defaults.full-text-search; default = defaults.full-text-search;
description = "Configuration for full-text search."; description = "Configuration for full-text search.";
}; };
addons = mkOption {
type = types.submodule({
options = {
working-dir = mkOption {
type = types.str;
default = defaults.addons.working-dir;
description = "Working directory";
};
cache-dir = mkOption {
type = types.str;
default = defaults.addons.cache-dir;
description = "Cache directory";
};
executor-config = mkOption {
type = types.submodule({
options = {
runner = mkOption {
type = types.str;
default = defaults.addons.executor-config.runner;
description = "The supported runners by this joex";
};
fail-fast = mkOption {
type = types.bool;
default = defaults.addons.executor-config.fail-fast;
description = "";
};
run-timeout = mkOption {
type = types.str;
default = defaults.addons.executor-config.run-timeout;
description = "";
};
nspawn = mkOption {
type = types.submodule({
options = {
enabled = mkOption {
type = types.bool;
default = defaults.addons.nspawn.enabled;
description = "Enable to use systemd-nspawn";
};
sudo-binary = mkOption {
type = types.str;
default = defaults.addons.executor-config.nspawn.sudo-binary;
description = "";
};
nspawn-binary = mkOption {
type = types.str;
default = defaults.addons.executor-config.nspawn.nspawn-binary;
description = "";
};
container-wait = mkOption {
type = types.str;
default = defaults.addons.executor-config.nspawn.container-wait;
description = "";
};
};
});
default = defaults.addons.executor-config.nspawn;
description = "";
};
nix-runner = mkOption {
type = types.submodule({
options = {
nix-binary = mkOption {
type = types.str;
default = defaults.addons.executor-config.nix-runner.nix-binary;
description = "";
};
build-timeout = mkOption {
type = types.str;
default = defaults.addons.executor-config.nix-runner.build-timeout;
description = "";
};
};
});
default = defaults.addons.executor-config.nix-runner;
description = "";
};
docker-runner = mkOption {
type = types.submodule({
options = {
docker-binary = mkOption {
type = types.str;
default = defaults.addons.executor-config.docker-runner.docker-binary;
description = "";
};
build-timeout = mkOption {
type = types.str;
default = defaults.addons.executor-config.docker-runner.build-timeout;
description = "";
};
};
});
default = defaults.addons.executor-config.docker-runner;
description = "";
};
};
});
default = defaults.addons.executor-config;
description = "";
};
};
});
default = defaults.addons;
description = "Addon executor config";
};
}; };
}; };

View File

@ -29,6 +29,12 @@ let
logging = { logging = {
minimum-level = "Info"; minimum-level = "Info";
format = "Fancy"; format = "Fancy";
levels = {
"docspell" = "Info";
"org.flywaydb" = "Info";
"binny" = "Info";
"org.http4s" = "Info";
};
}; };
integration-endpoint = { integration-endpoint = {
enabled = false; enabled = false;
@ -97,7 +103,7 @@ let
scope = "profile"; scope = "profile";
authorize-url = null; authorize-url = null;
token-url = null; token-url = null;
user-url = ""; user-url = null;
sign-key = ""; sign-key = "";
sig-algo = "RS256"; sig-algo = "RS256";
}; };
@ -120,6 +126,12 @@ let
chunk-size = 524288; chunk-size = 524288;
valid-mime-types = []; valid-mime-types = [];
}; };
addons = {
enabled = false;
allow-impure = true;
allowed-urls = ["*"];
denied-urls = [];
};
}; };
}; };
in { in {
@ -272,6 +284,11 @@ in {
default = defaults.logging.format; default = defaults.logging.format;
description = "The log format. One of: Fancy, Plain, Json or Logfmt"; description = "The log format. One of: Fancy, Plain, Json or Logfmt";
}; };
levels = mkOption {
type = types.attrs;
default = defaults.logging.levels;
description = "Set of logger and their levels";
};
}; };
}); });
default = defaults.logging; default = defaults.logging;
@ -401,7 +418,7 @@ in {
description = "The URL used to retrieve the token."; description = "The URL used to retrieve the token.";
}; };
user-url = mkOption { user-url = mkOption {
type = types.str; type = types.nullOr types.str;
default = defaults.openid.provider.user-url; default = defaults.openid.provider.user-url;
description = "The URL to the user-info endpoint."; description = "The URL to the user-info endpoint.";
}; };
@ -788,13 +805,39 @@ in {
default = defaults.backend.files; default = defaults.backend.files;
description= "Settings for how files are stored."; description= "Settings for how files are stored.";
}; };
addons = mkOption {
type = types.submodule({
options = {
enabled = mkOption {
type = types.bool;
default = defaults.backend.addons.enabled;
description = "Enable this feature";
};
allow-impure = mkOption {
type = types.bool;
default = defaults.backend.addons.allow-impure;
description = "Allow impure addons";
};
allowed-urls = mkOption {
type = types.listOf types.str;
default = defaults.backend.addons.allowed-urls;
description = "Url patterns of addons to be allowed";
};
denied-urls = mkOption {
type = types.listOf types.str;
default = defaults.backend.addons.denied-urls;
description = "Url patterns to deny to install";
};
};
});
default = defaults.backend.addons;
description = "Addon config";
};
}; };
}); });
default = defaults.backend; default = defaults.backend;
description = "Configuration for the backend"; description = "Configuration for the backend";
}; };
}; };
}; };