Merge pull request #313634 from onny/stalwart-systemd

stalwart-mail: package und use upstream systemd unit
This commit is contained in:
Yt 2024-05-31 21:11:45 +00:00 committed by GitHub
commit e45abe6d47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 57 additions and 51 deletions

View File

@ -76,7 +76,9 @@ in {
};
};
systemd.services.stalwart-mail = {
systemd = {
packages = [ cfg.package ];
services.stalwart-mail = {
wantedBy = [ "multi-user.target" ];
after = [ "local-fs.target" "network.target" ];
@ -87,22 +89,14 @@ in {
'';
serviceConfig = {
ExecStart =
"${cfg.package}/bin/stalwart-mail --config=${configFile}";
ExecStart = [
""
"${cfg.package}/bin/stalwart-mail --config=${configFile}"
];
# Base from template resources/systemd/stalwart-mail.service
Type = "simple";
LimitNOFILE = 65536;
KillMode = "process";
KillSignal = "SIGINT";
Restart = "on-failure";
RestartSec = 5;
StandardOutput = "journal";
StandardError = "journal";
SyslogIdentifier = "stalwart-mail";
User = "stalwart-mail";
Group = "stalwart-mail";
StateDirectory = "stalwart-mail";
# Bind standard privileged ports
@ -134,6 +128,11 @@ in {
SystemCallFilter = [ "@system-service" "~@privileged" ];
UMask = "0077";
};
unitConfig.ConditionPathExists = [
""
"${configFile}"
];
};
};
# Make admin commands available in the shell

View File

@ -62,6 +62,13 @@ rustPlatform.buildRustPackage {
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
};
postInstall = ''
mkdir -p $out/lib/systemd/system
substitute resources/systemd/stalwart-mail.service $out/lib/systemd/system/stalwart-mail.service \
--replace "__PATH__" "$out"
'';
# Tests require reading to /etc/resolv.conf
doCheck = false;