mirror of
https://seed.flo-the.dev/z3gWc1qgaeZaoGwL4WTstLNoqjayM.git
synced 2025-12-06 04:47:35 +01:00
33
module.nix
33
module.nix
@@ -1,4 +1,9 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.smtprd-ng;
|
||||
@@ -13,23 +18,23 @@ let
|
||||
hostname = cfg.client.hostname;
|
||||
port = cfg.client.port;
|
||||
username = cfg.client.username;
|
||||
password_file = if cfg.client.password_file != "" then
|
||||
"/run/credentials/smtprd-ng.service/password_file"
|
||||
else
|
||||
"";
|
||||
password_file =
|
||||
if cfg.client.password_file != "" then "/run/credentials/smtprd-ng.service/password_file" else "";
|
||||
sender = cfg.client.sender;
|
||||
use_tls = cfg.client.use_tls;
|
||||
start_tls = cfg.client.start_tls;
|
||||
smime_cert = cfg.client.smime_cert;
|
||||
smime_cert_private = if cfg.client.smime_cert_private != "" then
|
||||
"/run/credentials/smtprd-ng.service/smime_cert_private"
|
||||
else
|
||||
"";
|
||||
smime_cert_private =
|
||||
if cfg.client.smime_cert_private != "" then
|
||||
"/run/credentials/smtprd-ng.service/smime_cert_private"
|
||||
else
|
||||
"";
|
||||
};
|
||||
emails = cfg.emails;
|
||||
};
|
||||
confFile = pkgs.writeText "config.ini" cfgText;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.smtprd-ng = {
|
||||
enable = mkEnableOption "smtprd-ng";
|
||||
|
||||
@@ -148,10 +153,10 @@ in {
|
||||
message = "Use either TLS or STARTTLS, not both.";
|
||||
}
|
||||
{
|
||||
assertion = cfg.client.smime_cert == null || (cfg.client.smime_cert
|
||||
!= null && cfg.client.smime_cert_private != null);
|
||||
message =
|
||||
"If a S/MIME certificate should be used to sign messages, the private key to this certificate must be supplied.";
|
||||
assertion =
|
||||
cfg.client.smime_cert == null
|
||||
|| (cfg.client.smime_cert != null && cfg.client.smime_cert_private != null);
|
||||
message = "If a S/MIME certificate should be used to sign messages, the private key to this certificate must be supplied.";
|
||||
}
|
||||
{
|
||||
assertion = cfg.emails != null;
|
||||
|
||||
Reference in New Issue
Block a user