nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

nixos/public-inbox: remove spamassassin integration

This hasn't worked since before this module ended up in Nixpkgs,
because public-inbox-init runs as the public-inbox user, but tries to
install -o spamd.

+1 -51
+1 -51
nixos/modules/services/mail/public-inbox.nix
··· 9 9 gitIni = pkgs.formats.gitIni { listsAsDuplicateKeys = true; }; 10 10 iniAtom = elemAt gitIni.type/*attrsOf*/.functor.wrapped/*attrsOf*/.functor.wrapped/*either*/.functor.wrapped 0; 11 11 12 - useSpamAssassin = cfg.settings.publicinboxmda.spamcheck == "spamc" || 13 - cfg.settings.publicinboxwatch.spamcheck == "spamc"; 14 - 15 12 publicInboxDaemonOptions = proto: defaultPort: { 16 13 args = mkOption { 17 14 type = with types; listOf str; ··· 255 258 nntp = { 256 259 enable = mkEnableOption (lib.mdDoc "the public-inbox NNTP server"); 257 260 } // publicInboxDaemonOptions "nntp" 563; 258 - spamAssassinRules = mkOption { 259 - type = with types; nullOr path; 260 - default = "${cfg.package.sa_config}/user/.spamassassin/user_prefs"; 261 - defaultText = literalExpression "\${cfg.package.sa_config}/user/.spamassassin/user_prefs"; 262 - description = lib.mdDoc "SpamAssassin configuration specific to public-inbox."; 263 - }; 264 261 settings = mkOption { 265 262 description = lib.mdDoc '' 266 263 Settings for the [public-inbox config file](https://public-inbox.org/public-inbox-config.html). ··· 303 312 }; 304 313 }; 305 314 }; 306 - options.publicinboxmda.spamcheck = mkOption { 307 - type = with types; enum [ "spamc" "none" ]; 308 - default = "none"; 309 - description = lib.mdDoc '' 310 - If set to spamc, {manpage}`public-inbox-watch(1)` will filter spam 311 - using SpamAssassin. 312 - ''; 313 - }; 314 - options.publicinboxwatch.spamcheck = mkOption { 315 - type = with types; enum [ "spamc" "none" ]; 316 - default = "none"; 317 - description = lib.mdDoc '' 318 - If set to spamc, {manpage}`public-inbox-watch(1)` will filter spam 319 - using SpamAssassin. 320 - ''; 321 - }; 322 315 options.publicinboxwatch.watchspam = mkOption { 323 316 type = with types; nullOr str; 324 317 default = null; ··· 332 357 openFirewall = mkEnableOption (lib.mdDoc "opening the firewall when using a port option"); 333 358 }; 334 359 config = mkIf cfg.enable { 335 - assertions = [ 336 - { assertion = config.services.spamassassin.enable || !useSpamAssassin; 337 - message = '' 338 - public-inbox is configured to use SpamAssassin, but 339 - services.spamassassin.enable is false. If you don't need 340 - spam checking, set `services.public-inbox.settings.publicinboxmda.spamcheck' and 341 - `services.public-inbox.settings.publicinboxwatch.spamcheck' to null. 342 - ''; 343 - } 344 - { assertion = cfg.path != [] || !useSpamAssassin; 345 - message = '' 346 - public-inbox is configured to use SpamAssassin, but there is 347 - no spamc executable in services.public-inbox.path. If you 348 - don't need spam checking, set 349 - `services.public-inbox.settings.publicinboxmda.spamcheck' and 350 - `services.public-inbox.settings.publicinboxwatch.spamcheck' to null. 351 - ''; 352 - } 353 - ]; 354 360 services.public-inbox.settings = 355 361 filterAttrsRecursive (n: v: v != null) { 356 362 publicinbox = mapAttrs (n: filterAttrs (n: v: n != "description")) cfg.inboxes; ··· 470 514 { public-inbox-watch = mkMerge [(serviceConfig "watch") { 471 515 inherit (cfg) path; 472 516 wants = [ "public-inbox-init.service" ]; 473 - requires = [ "public-inbox-init.service" ] ++ 474 - optional (cfg.settings.publicinboxwatch.spamcheck == "spamc") "spamassassin.service"; 517 + requires = [ "public-inbox-init.service" ]; 475 518 wantedBy = [ "multi-user.target" ]; 476 519 serviceConfig = { 477 520 ExecStart = "${cfg.package}/bin/public-inbox-watch"; ··· 488 533 script = '' 489 534 set -ux 490 535 install -D -p ${PI_CONFIG} ${stateDir}/.public-inbox/config 491 - '' + optionalString useSpamAssassin '' 492 - install -m 0700 -o spamd -d ${stateDir}/.spamassassin 493 - ${optionalString (cfg.spamAssassinRules != null) '' 494 - ln -sf ${cfg.spamAssassinRules} ${stateDir}/.spamassassin/user_prefs 495 - ''} 496 536 '' + concatStrings (mapAttrsToList (name: inbox: '' 497 537 if [ ! -e ${stateDir}/inboxes/${escapeShellArg name} ]; then 498 538 # public-inbox-init creates an inbox and adds it to a config file.