Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d30e143c055c
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 11d0942d6672
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Sep 27, 2017

  1. 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 #29414.
    
    (cherry picked from commit bfab392)
    peti committed Sep 27, 2017

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    a30571c View commit details
  2. nixos(spamassassin): fix trailing whitespace

    (cherry picked from commit 99e2459)
    peti committed Sep 27, 2017
    Copy the full SHA
    11d0942 View commit details
Showing with 12 additions and 13 deletions.
  1. +12 −13 nixos/modules/services/mail/spamassassin.nix
25 changes: 12 additions & 13 deletions nixos/modules/services/mail/spamassassin.nix
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ in
Then you can Use this sieve filter:
require ["fileinto", "reject", "envelope"];
if header :contains "X-Spam-Flag" "YES" {
fileinto "spam";
}
@@ -67,11 +67,11 @@ in
initPreConf = mkOption {
type = types.str;
description = "The SpamAssassin init.pre config.";
default =
''
default =
''
#
# to update this list, run this command in the rules directory:
# grep 'loadplugin.*Mail::SpamAssassin::Plugin::.*' -o -h * | sort | uniq
# grep 'loadplugin.*Mail::SpamAssassin::Plugin::.*' -o -h * | sort | uniq
#
#loadplugin Mail::SpamAssassin::Plugin::AccessDB
@@ -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";
@@ -138,7 +142,7 @@ in

systemd.services.sa-update = {
script = ''
set +e
set +e
${pkgs.su}/bin/su -s "${pkgs.bash}/bin/bash" -c "${pkgs.spamassassin}/bin/sa-update --gpghomedir=/var/lib/spamassassin/sa-update-keys/ --siteconfigpath=${spamdEnv}/" spamd
v=$?
@@ -153,7 +157,7 @@ in
'';
};

systemd.timers.sa-update = {
systemd.timers.sa-update = {
description = "sa-update-service";
partOf = [ "sa-update.service" ];
wantedBy = [ "timers.target" ];
@@ -177,15 +181,10 @@ 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
set +e
set +e
${pkgs.su}/bin/su -s "${pkgs.bash}/bin/bash" -c "${pkgs.spamassassin}/bin/sa-update --gpghomedir=/var/lib/spamassassin/sa-update-keys/ --siteconfigpath=${spamdEnv}/" spamd
v=$?
set -e