nixos/paperless: convert extraConfig to freeform type
Co-authored-by: Atemu <atemu.main@gmail.com>
This commit is contained in:
parent
054533f5c8
commit
7c1b4b22f9
@ -56,6 +56,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
|
|||||||
|
|
||||||
- Invidious has changed its default database username from `kemal` to `invidious`. Setups involving an externally provisioned database (i.e. `services.invidious.database.createLocally == false`) should adjust their configuration accordingly. The old `kemal` user will not be removed automatically even when the database is provisioned automatically.(https://github.com/NixOS/nixpkgs/pull/265857)
|
- Invidious has changed its default database username from `kemal` to `invidious`. Setups involving an externally provisioned database (i.e. `services.invidious.database.createLocally == false`) should adjust their configuration accordingly. The old `kemal` user will not be removed automatically even when the database is provisioned automatically.(https://github.com/NixOS/nixpkgs/pull/265857)
|
||||||
|
|
||||||
|
- `paperless`' `services.paperless.extraConfig` setting has been removed and converted to the freeform type and option named `services.paperless.settings`.
|
||||||
|
|
||||||
- `mkosi` was updated to v19. Parts of the user interface have changed. Consult the
|
- `mkosi` was updated to v19. Parts of the user interface have changed. Consult the
|
||||||
[release notes](https://github.com/systemd/mkosi/releases/tag/v19) for a list of changes.
|
[release notes](https://github.com/systemd/mkosi/releases/tag/v19) for a list of changes.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ let
|
|||||||
defaultFont = "${pkgs.liberation_ttf}/share/fonts/truetype/LiberationSerif-Regular.ttf";
|
defaultFont = "${pkgs.liberation_ttf}/share/fonts/truetype/LiberationSerif-Regular.ttf";
|
||||||
|
|
||||||
# Don't start a redis instance if the user sets a custom redis connection
|
# Don't start a redis instance if the user sets a custom redis connection
|
||||||
enableRedis = !hasAttr "PAPERLESS_REDIS" cfg.extraConfig;
|
enableRedis = !(cfg.settings ? PAPERLESS_REDIS);
|
||||||
redisServer = config.services.redis.servers.paperless;
|
redisServer = config.services.redis.servers.paperless;
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
@ -24,9 +24,11 @@ let
|
|||||||
PAPERLESS_TIME_ZONE = config.time.timeZone;
|
PAPERLESS_TIME_ZONE = config.time.timeZone;
|
||||||
} // optionalAttrs enableRedis {
|
} // optionalAttrs enableRedis {
|
||||||
PAPERLESS_REDIS = "unix://${redisServer.unixSocket}";
|
PAPERLESS_REDIS = "unix://${redisServer.unixSocket}";
|
||||||
} // (
|
} // (lib.mapAttrs (_: s:
|
||||||
lib.mapAttrs (_: toString) cfg.extraConfig
|
if (lib.isAttrs s || lib.isList s) then builtins.toJSON s
|
||||||
);
|
else if lib.isBool s then lib.boolToString s
|
||||||
|
else toString s
|
||||||
|
) cfg.settings);
|
||||||
|
|
||||||
manage = pkgs.writeShellScript "manage" ''
|
manage = pkgs.writeShellScript "manage" ''
|
||||||
set -o allexport # Export the following env vars
|
set -o allexport # Export the following env vars
|
||||||
@ -82,6 +84,7 @@ in
|
|||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule [ "services" "paperless-ng" ] [ "services" "paperless" ])
|
(mkRenamedOptionModule [ "services" "paperless-ng" ] [ "services" "paperless" ])
|
||||||
|
(mkRenamedOptionModule [ "services" "paperless" "extraConfig" ] [ "services" "paperless" "settings" ])
|
||||||
];
|
];
|
||||||
|
|
||||||
options.services.paperless = {
|
options.services.paperless = {
|
||||||
@ -160,32 +163,30 @@ in
|
|||||||
description = lib.mdDoc "Web interface port.";
|
description = lib.mdDoc "Web interface port.";
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME this should become an RFC42-style settings attr
|
settings = mkOption {
|
||||||
extraConfig = mkOption {
|
type = lib.types.submodule {
|
||||||
type = types.attrs;
|
freeformType = with lib.types; attrsOf (let
|
||||||
|
typeList = [ bool float int str path package ];
|
||||||
|
in oneOf (typeList ++ [ (listOf (oneOf typeList)) (attrsOf (oneOf typeList)) ]));
|
||||||
|
};
|
||||||
default = { };
|
default = { };
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Extra paperless config options.
|
Extra paperless config options.
|
||||||
|
|
||||||
See [the documentation](https://docs.paperless-ngx.com/configuration/)
|
See [the documentation](https://docs.paperless-ngx.com/configuration/) for available options.
|
||||||
for available options.
|
|
||||||
|
|
||||||
Note that some options such as `PAPERLESS_CONSUMER_IGNORE_PATTERN` expect JSON values. Use `builtins.toJSON` to ensure proper quoting.
|
Note that some settings such as `PAPERLESS_CONSUMER_IGNORE_PATTERN` expect JSON values.
|
||||||
|
Settings declared as lists or attrsets will automatically be serialised into JSON strings for your convenience.
|
||||||
'';
|
'';
|
||||||
example = literalExpression ''
|
example = {
|
||||||
{
|
|
||||||
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
||||||
|
|
||||||
PAPERLESS_DBHOST = "/run/postgresql";
|
PAPERLESS_DBHOST = "/run/postgresql";
|
||||||
|
PAPERLESS_CONSUMER_IGNORE_PATTERN = [ ".DS_STORE/*" "desktop.ini" ];
|
||||||
PAPERLESS_CONSUMER_IGNORE_PATTERN = builtins.toJSON [ ".DS_STORE/*" "desktop.ini" ];
|
PAPERLESS_OCR_USER_ARGS = {
|
||||||
|
|
||||||
PAPERLESS_OCR_USER_ARGS = builtins.toJSON {
|
|
||||||
optimize = 1;
|
optimize = 1;
|
||||||
pdfa_image_compression = "lossless";
|
pdfa_image_compression = "lossless";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
|
Loading…
Reference in New Issue
Block a user