diff --git a/nix/checks/configuration-test.nix b/nix/checks/configuration-test.nix index a95edb83..c78f9b33 100644 --- a/nix/checks/configuration-test.nix +++ b/nix/checks/configuration-test.nix @@ -58,6 +58,16 @@ in } ]; inherit full-text-search; + extraConfig = { + files = { + default-store = "database"; + stores = { + minio = { + enabled = true; + }; + }; + }; + }; }; environment.systemPackages = diff --git a/nix/modules/joex.nix b/nix/modules/joex.nix index e6d5dcce..72996727 100644 --- a/nix/modules/joex.nix +++ b/nix/modules/joex.nix @@ -3,10 +3,12 @@ overlay: { config, lib, pkgs, ... }: with lib; let cfg = config.services.docspell-joex; + # Extract the config without the extraConfig attribute. It will be merged later + declared_config = attrsets.filterAttrs (n: v: n != "extraConfig") cfg; user = if cfg.runAs == null then "docspell" else cfg.runAs; configFile = pkgs.writeText "docspell-joex.conf" '' {"docspell": { "joex": - ${builtins.toJSON cfg} + ${builtins.toJSON (lib.recursiveUpdate declared_config cfg.extraConfig)} }} ''; defaults = { @@ -1670,6 +1672,23 @@ in default = defaults.addons; description = "Addon executor config"; }; + extraConfig = mkOption { + type = types.attrs; + description = "Extra configuration for docspell server. Overwrites values in case of a conflict."; + default = { }; + example = '' + { + files = { + default-store = "minio"; + stores = { + minio = { + enabled = true; + }; + }; + }; + } + ''; + }; }; }; diff --git a/nix/modules/server.nix b/nix/modules/server.nix index 33e3aaa7..4a98c8dc 100644 --- a/nix/modules/server.nix +++ b/nix/modules/server.nix @@ -3,10 +3,12 @@ overlay: { config, lib, pkgs, ... }: with lib; let cfg = config.services.docspell-restserver; + # Extract the config without the extraConfig attribute. It will be merged later + declared_config = attrsets.filterAttrs (n: v: n != "extraConfig") cfg; user = if cfg.runAs == null then "docspell" else cfg.runAs; configFile = pkgs.writeText "docspell-server.conf" '' {"docspell": {"server": - ${builtins.toJSON cfg} + ${builtins.toJSON (lib.recursiveUpdate declared_config cfg.extraConfig)} }} ''; defaults = { @@ -839,6 +841,23 @@ in default = defaults.backend; description = "Configuration for the backend"; }; + extraConfig = mkOption { + type = types.attrs; + description = "Extra configuration for docspell server. Overwrites values in case of a conflict."; + default = { }; + example = '' + { + files = { + default-store = "minio"; + stores = { + minio = { + enabled = true; + }; + }; + }; + } + ''; + }; }; };