diff options
author | Peter Simons <simons@cryp.to> | 2017-09-27 14:34:47 +0200 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2017-09-27 14:50:52 +0200 |
commit | bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2 (patch) | |
tree | d03f2dd71bf656277740e7b358f1e657f8e087c3 /nixos/modules/services/mail | |
parent | 3abee357e6e6eec105bb3125094ec0f78423a52a (diff) | |
download | nixlib-bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2.tar nixlib-bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2.tar.gz nixlib-bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2.tar.bz2 nixlib-bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2.tar.lz nixlib-bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2.tar.xz nixlib-bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2.tar.zst nixlib-bfab392e6edf20be2cfa8a457a65c2e6b4cfedc2.zip |
nixos(spamassassin): provide /etc/spamassassin to fix sa-learn et al
Spamassassin expects its system-wide configuration at /etc/spamassassin, and some user tools (like sa-learn) need to read those configuration files. Therefore, we provide a symlink from /etc/spamassassin to the appropriate Nix store path to make sure those tools work without the user having to pass an elaborate --siteconfig path that, potentially, changes every time the system updates. Fixes https://github.com/NixOS/nixpkgs/issues/29414.
Diffstat (limited to 'nixos/modules/services/mail')
-rw-r--r-- | nixos/modules/services/mail/spamassassin.nix | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/nixos/modules/services/mail/spamassassin.nix b/nixos/modules/services/mail/spamassassin.nix index fc8396cd85e9..ba0e5aeb0b5b 100644 --- a/nixos/modules/services/mail/spamassassin.nix +++ b/nixos/modules/services/mail/spamassassin.nix @@ -122,7 +122,11 @@ in config = mkIf cfg.enable { # Allow users to run 'spamc'. - environment.systemPackages = [ pkgs.spamassassin ]; + + environment = { + etc = singleton { source = spamdEnv; target = "spamassassin"; }; + systemPackages = [ pkgs.spamassassin ]; + }; users.extraUsers = singleton { name = "spamd"; @@ -177,11 +181,6 @@ in # 0 and 1 no error, exitcode > 1 means error: # https://spamassassin.apache.org/full/3.1.x/doc/sa-update.html#exit_codes preStart = '' - # this abstraction requires no centralized config at all - if [ -d /etc/spamassassin ]; then - echo "This spamassassin does not support global '/etc/spamassassin' folder for configuration as this would be impure. Merge your configs into 'services.spamassassin' and remove the '/etc/spamassassin' folder to make this service work. Also see 'https://github.com/NixOS/nixpkgs/pull/26470'."; - exit 1 - fi echo "Recreating '/var/lib/spamasassin' with creating '3.004001' (or similar) and 'sa-update-keys'" mkdir -p /var/lib/spamassassin chown spamd:spamd /var/lib/spamassassin -R |