1 { config, lib, pkgs, ... }:
9 enable = lib.mkOption {
11 type = lib.types.bool;
12 description = "Whether to run the postfix sender rewriting scheme daemon.";
15 domain = lib.mkOption {
16 description = "The domain for which to enable srs";
18 example = "example.com";
21 secretsFile = lib.mkOption {
23 The secret data used to encode the SRS address.
24 to generate, use a command like:
25 `for n in $(seq 5); do dd if=/dev/urandom count=1 bs=1024 status=none | sha256sum | sed 's/ -$//' | sed 's/^/ /'; done`
27 type = lib.types.path;
28 default = "/var/lib/pfix-srsd/secrets";
35 config = lib.mkIf config.services.pfix-srsd.enable {
37 systemPackages = [ pkgs.pfixtools ];
40 systemd.services.pfix-srsd = {
41 description = "Postfix sender rewriting scheme daemon";
42 before = [ "postfix.service" ];
43 #note that we use requires rather than wants because postfix
44 #is unable to process (almost) all mail without srsd
45 requiredBy = [ "postfix.service" ];
48 PIDFile = "/run/pfix-srsd.pid";
49 ExecStart = "${pkgs.pfixtools}/bin/pfix-srsd -p /run/pfix-srsd.pid -I ${config.services.pfix-srsd.domain} ${config.services.pfix-srsd.secretsFile}";