git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #19874 from joachifm/opensmtpd-refactorings

Opensmtpd module refactorings

commit371a595f3c4476445a95acccb5695eb0cc9e9c64 authorJoachim F <joachifm@users.noreply.github.com> dateThu 27 Oct 2016, 13:39 (10 years ago) parent600f4ddab1e216
1 file changed+7−11
nixos/modules/services/mail/opensmtpd.nix+7−11
nixos/modules/services/mail/opensmtpd.nix+7−11
@@ -1,17 +1,16 @@
11{ config, lib, pkgs, ... }:
22
3−with pkgs;
43with lib;
54
65let
76
87 cfg = config.services.opensmtpd;
9− conf = writeText "smtpd.conf" cfg.serverConfiguration;
8+ conf = pkgs.writeText "smtpd.conf" cfg.serverConfiguration;
109 args = concatStringsSep " " cfg.extraServerArgs;
1110
1211 sendmail = pkgs.runCommand "opensmtpd-sendmail" {} ''
1312 mkdir -p $out/bin
14− ln -s ${opensmtpd}/sbin/smtpctl $out/bin/sendmail
13+ ln -s ${pkgs.opensmtpd}/sbin/smtpctl $out/bin/sendmail
1514 '';
1615
1716in {
@@ -48,21 +47,19 @@ in {
4847 };
4948
5049 serverConfiguration = mkOption {
51− type = types.string;
52− default = "";
50+ type = types.lines;
5351 example = ''
5452 listen on lo
5553 accept for any deliver to lmtp localhost:24
56− '';
54+ '';
5755 description = ''
5856 The contents of the smtpd.conf configuration file. See the
59− OpenSMTPD documentation for syntax information. If this option
60− is left empty, the OpenSMTPD server will not start.
57+ OpenSMTPD documentation for syntax information.
6158 '';
6259 };
6360
6461 procPackages = mkOption {
65− type = types.listOf types.path;
62+ type = types.listOf types.package;
6663 default = [];
6764 description = ''
6865 Packages to search for filters, tables, queues, and schedulers.
@@ -100,12 +97,11 @@ in {
10097 systemd.services.opensmtpd = let
10198 procEnv = pkgs.buildEnv {
10299 name = "opensmtpd-procs";
103− paths = [ opensmtpd ] ++ cfg.procPackages;
100+ paths = [ pkgs.opensmtpd ] ++ cfg.procPackages;
104101 pathsToLink = [ "/libexec/opensmtpd" ];
105102 };
106103 in {
107104 wantedBy = [ "multi-user.target" ];
108− wants = [ "network.target" ];
109105 after = [ "network.target" ];
110106 preStart = ''
111107 mkdir -p /var/spool/smtpd