Merge pull request #19874 from joachifm/opensmtpd-refactorings

Opensmtpd module refactorings
This commit is contained in:
Joachim F 2016-10-27 13:39:09 +02:00 committed by GitHub
commit 371a595f3c

View File

@ -1,17 +1,16 @@
{ config, lib, pkgs, ... }:
with pkgs;
with lib;
let
cfg = config.services.opensmtpd;
conf = writeText "smtpd.conf" cfg.serverConfiguration;
conf = pkgs.writeText "smtpd.conf" cfg.serverConfiguration;
args = concatStringsSep " " cfg.extraServerArgs;
sendmail = pkgs.runCommand "opensmtpd-sendmail" {} ''
mkdir -p $out/bin
ln -s ${opensmtpd}/sbin/smtpctl $out/bin/sendmail
ln -s ${pkgs.opensmtpd}/sbin/smtpctl $out/bin/sendmail
'';
in {
@ -48,21 +47,19 @@ in {
};
serverConfiguration = mkOption {
type = types.string;
default = "";
type = types.lines;
example = ''
listen on lo
accept for any deliver to lmtp localhost:24
'';
description = ''
The contents of the smtpd.conf configuration file. See the
OpenSMTPD documentation for syntax information. If this option
is left empty, the OpenSMTPD server will not start.
OpenSMTPD documentation for syntax information.
'';
};
procPackages = mkOption {
type = types.listOf types.path;
type = types.listOf types.package;
default = [];
description = ''
Packages to search for filters, tables, queues, and schedulers.
@ -100,12 +97,11 @@ in {
systemd.services.opensmtpd = let
procEnv = pkgs.buildEnv {
name = "opensmtpd-procs";
paths = [ opensmtpd ] ++ cfg.procPackages;
paths = [ pkgs.opensmtpd ] ++ cfg.procPackages;
pathsToLink = [ "/libexec/opensmtpd" ];
};
in {
wantedBy = [ "multi-user.target" ];
wants = [ "network.target" ];
after = [ "network.target" ];
preStart = ''
mkdir -p /var/spool/smtpd