nixpkgs/nixos/modules/services/mail/rspamd-trainer.nix
stuebinm 6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00

77 lines
1.8 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.rspamd-trainer;
format = pkgs.formats.toml { };
in {
options.services.rspamd-trainer = {
enable = mkEnableOption "Spam/ham trainer for rspamd";
settings = mkOption {
default = { };
description = ''
IMAP authentication configuration for rspamd-trainer. For supplying
the IMAP password, use the `secrets` option.
'';
type = types.submodule {
freeformType = format.type;
};
example = literalExpression ''
{
HOST = "localhost";
USERNAME = "spam@example.com";
INBOXPREFIX = "INBOX/";
}
'';
};
secrets = lib.mkOption {
type = with types; listOf path;
description = ''
A list of files containing the various secrets. Should be in the
format expected by systemd's `EnvironmentFile` directory. For the
IMAP account password use `PASSWORD = mypassword`.
'';
default = [ ];
};
};
config = mkIf cfg.enable {
systemd = {
services.rspamd-trainer = {
description = "Spam/ham trainer for rspamd";
serviceConfig = {
ExecStart = "${pkgs.rspamd-trainer}/bin/rspamd-trainer";
WorkingDirectory = "/var/lib/rspamd-trainer";
StateDirectory = [ "rspamd-trainer/log" ];
Type = "oneshot";
DynamicUser = true;
EnvironmentFile = [
( format.generate "rspamd-trainer-env" cfg.settings )
cfg.secrets
];
};
};
timers."rspamd-trainer" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "10m";
OnUnitActiveSec = "10m";
Unit = "rspamd-trainer.service";
};
};
};
};
meta.maintainers = with lib.maintainers; [ onny ];
}