-
-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
176 changed files
with
3,213 additions
and
1,172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
|
||
cfg = config.services.rspamd-trainer; | ||
format = pkgs.formats.toml { }; | ||
|
||
in { | ||
options.services.rspamd-trainer = { | ||
|
||
enable = mkEnableOption (mdDoc "Spam/ham trainer for rspamd"); | ||
|
||
settings = mkOption { | ||
default = { }; | ||
description = mdDoc '' | ||
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 = lib.mdDoc '' | ||
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 ]; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.