Skip to content

Instantly share code, notes, and snippets.

@pjones
Created March 19, 2019 21:15
Show Gist options
  • Save pjones/1d6db986d01dbf188dbc5808434db44d to your computer and use it in GitHub Desktop.
Save pjones/1d6db986d01dbf188dbc5808434db44d to your computer and use it in GitHub Desktop.
# rspamd configuration:
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.phoebe.services.mailstack;
# rspam configuration files:
extra-conf = pkgs.stdenvNoCC.mkDerivation {
name = "rspamd-extra-conf";
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/conf
for file in ${./conf}/*.conf; do
install -m 0444 "$file" "$out/conf/$(basename "$file")"
done
'';
};
in
{
###### Implementation
config = mkIf cfg.enable {
############################################################################
# Force rmilter to disable since we don't need it anymore. I'm
# not sure why but it's getting turned on somewhere in NixOS 18.09.
services.rmilter.enable = false;
############################################################################
# Use a Redis cache:
services.redis = {
enable = true;
bind = "localhost";
};
############################################################################
# rspamd:
services.rspamd = {
enable = true;
debug = false;
# Extra configuration:
extraConfig = ''
.include "${extra-conf}/conf/workers.conf"
.include "${extra-conf}/conf/metrics.conf"
'';
};
############################################################################
# Place some files where rspamd will read them:
environment.etc."rspamd/override.d/actions.conf".source =
"${extra-conf}/conf/actions.conf";
environment.etc."rspamd/override.d/redis.conf".source =
"${extra-conf}/conf/redis.conf";
environment.etc."rspamd/override.d/milter_headers.conf".source =
"${extra-conf}/conf/milter_headers.conf";
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment