diff options
author | Yves Fischer <yvesf+git@xapek.org> | 2021-02-18 23:21:23 +0100 |
---|---|---|
committer | Yves Fischer <yvesf+git@xapek.org> | 2021-02-18 23:21:23 +0100 |
commit | 11d29e09ce7f8bada434090a69bac5dc7a6a9683 (patch) | |
tree | 583671b7218387f7fcbc12bfd73a53cd3ed80593 | |
parent | 7e420c5d5b2bb4c638fe2278ac69a69e4a6c06e6 (diff) | |
download | smtp-forward-11d29e09ce7f8bada434090a69bac5dc7a6a9683.tar.gz smtp-forward-11d29e09ce7f8bada434090a69bac5dc7a6a9683.zip |
config
-rw-r--r-- | module.nix | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -6,14 +6,14 @@ in { options.services.smtp-forward = { enable = lib.mkEnableOption "the smtp-forward service"; mapping = lib.mkOption { - type = lib.types.str; + type = lib.types.strMatching "([^:]+:[^:]+@[^,]+)(,[^:]+:[^:]+@[^,]+)*"; default = "prefix1:addres@host,prefix2:address@host"; description = "-m maps prefixes to email addresses"; }; listen = lib.mkOption { type = lib.types.str; default = ":25"; - description = "Adress to listen on"; + description = "-l sets the address to listen on"; }; hostname = lib.mkOption { type = lib.types.str; @@ -21,14 +21,14 @@ in { description = "-h sets the server hostname"; }; key = lib.mkOption { - type = lib.types.str; - default = "setme"; - description = "-k sets the TLS key"; + type = lib.types.path; + default = null; + description = "-k /path/to/file sets the TLS key file"; }; cert = lib.mkOption { - type = lib.types.str; - default = "setme"; - description = "-c sets the TLS key"; + type = lib.types.path; + default = null; + description = "-c /path/to/file" sets the TLS certificate file"; }; }; config = lib.mkIf config.services.smtp-forward.enable { @@ -37,7 +37,9 @@ in { path = [ package ]; wantedBy = [ "default.target" ]; script = '' - ${package}/bin/smtp-forward -l ${cfg.listen} -m ${cfg.mapping} -h ${cfg.hostname} -k ${cfg.key} -c ${cfg.cert} + ${package}/bin/smtp-forward -l ${cfg.listen} -m ${cfg.mapping} -h ${cfg.hostname} \ + ${lib.optionalString (cfg.key != null) "-k ${cfg.key}"} \ + ${lib.optionalString (cfg.cert != null) "-c ${cfg.cert}"} ''; serviceConfig = { User = "smtp-forward"; |