summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2018-11-25 21:07:42 +0100
committerGitHub <noreply@github.com>2018-11-25 21:07:42 +0100
commitb5f4f228d666aebdda2506a55d94c4ce6fb9a6e1 (patch)
tree8f3ba7869116178b467c0a9c4ce90c6d97b7428b /nixos
parent604b0f34c96e0c72640719d59bcc92cb64550ff0 (diff)
parent0d753af6617bb74535af0601a2cdce1a8c647889 (diff)
downloadnixpkgs-b5f4f228d666aebdda2506a55d94c4ce6fb9a6e1.tar
nixpkgs-b5f4f228d666aebdda2506a55d94c4ce6fb9a6e1.tar.gz
nixpkgs-b5f4f228d666aebdda2506a55d94c4ce6fb9a6e1.tar.bz2
nixpkgs-b5f4f228d666aebdda2506a55d94c4ce6fb9a6e1.tar.lz
nixpkgs-b5f4f228d666aebdda2506a55d94c4ce6fb9a6e1.tar.xz
nixpkgs-b5f4f228d666aebdda2506a55d94c4ce6fb9a6e1.tar.zst
nixpkgs-b5f4f228d666aebdda2506a55d94c4ce6fb9a6e1.zip
Merge pull request #51012 from griff/rspamd-proxy-type
nixos/rspamd: Allow worker type to be proxy again
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/mail/rspamd.nix17
-rw-r--r--nixos/tests/rspamd.nix1
2 files changed, 15 insertions, 3 deletions
diff --git a/nixos/modules/services/mail/rspamd.nix b/nixos/modules/services/mail/rspamd.nix
index 1c37ae41e07..c9ba8678021 100644
--- a/nixos/modules/services/mail/rspamd.nix
+++ b/nixos/modules/services/mail/rspamd.nix
@@ -45,7 +45,9 @@ let
       else "${config.socket}${maybeOption "mode"}${maybeOption "owner"}${maybeOption "group"}";
   };
 
-  workerOpts = { name, ... }: {
+  traceWarning = w: x: builtins.trace "warning: ${w}" x;
+
+  workerOpts = { name, options, ... }: {
     options = {
       enable = mkOption {
         type = types.nullOr types.bool;
@@ -59,9 +61,18 @@ let
       };
       type = mkOption {
         type = types.nullOr (types.enum [
-          "normal" "controller" "fuzzy_storage" "rspamd_proxy" "lua"
+          "normal" "controller" "fuzzy_storage" "rspamd_proxy" "lua" "proxy"
         ]);
-        description = "The type of this worker";
+        description = ''
+          The type of this worker. The type <literal>proxy</literal> is
+          deprecated and only kept for backwards compatibility and should be
+          replaced with <literal>rspamd_proxy</literal>.
+        '';
+        apply = let
+            from = "services.rspamd.workers.\”${name}\".type";
+            files = options.type.files;
+            warning = "The option `${from}` defined in ${showFiles files} has enum value `proxy` which has been renamed to `rspamd_proxy`";
+          in x: if x == "proxy" then traceWarning warning "rspamd_proxy" else x;
       };
       bindSockets = mkOption {
         type = types.listOf (types.either types.str (types.submodule bindSocketOpts));
diff --git a/nixos/tests/rspamd.nix b/nixos/tests/rspamd.nix
index e16a9e6ffbc..396cd5b67d8 100644
--- a/nixos/tests/rspamd.nix
+++ b/nixos/tests/rspamd.nix
@@ -235,6 +235,7 @@ in
       services.rspamd = {
         enable = true;
         postfix.enable = true;
+        workers.rspamd_proxy.type = "proxy";
       };
     };
     testScript = ''