Merge pull request #74048 from ckauhaus/ssmtp-named-ssmtp

ssmtp: use services.ssmtp not networking.defaultMailServer
This commit is contained in:
Florian Klink 2019-11-28 16:32:50 +01:00 committed by GitHub
commit 4e8c2f08b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View file

@ -8,18 +8,16 @@
with lib; with lib;
let let
cfg = config.services.ssmtp;
cfg = config.networking.defaultMailServer;
in in
{ {
options = { options = {
networking.defaultMailServer = { services.ssmtp = {
directDelivery = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
@ -29,7 +27,7 @@ in
<command>sendmail</command> or <command>postfix</command> on <command>sendmail</command> or <command>postfix</command> on
your machine, set this option to <literal>true</literal>, and your machine, set this option to <literal>true</literal>, and
set the option set the option
<option>networking.defaultMailServer.hostName</option> to the <option>services.ssmtp.hostName</option> to the
host name of your preferred mail server. host name of your preferred mail server.
''; '';
}; };
@ -129,9 +127,9 @@ in
}; };
config = mkIf cfg.directDelivery { config = mkIf cfg.enable {
networking.defaultMailServer.authPassFile = mkIf (cfg.authPass != "") services.ssmtp.authPassFile = mkIf (cfg.authPass != "")
(mkDefault (toString (pkgs.writeTextFile { (mkDefault (toString (pkgs.writeTextFile {
name = "ssmtp-authpass"; name = "ssmtp-authpass";
text = cfg.authPass; text = cfg.authPass;

View file

@ -11,6 +11,8 @@ with lib;
(mkRenamedOptionModule [ "networking" "enableRTL8192cFirmware" ] [ "hardware" "enableRedistributableFirmware" ]) (mkRenamedOptionModule [ "networking" "enableRTL8192cFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
(mkRenamedOptionModule [ "networking" "networkmanager" "useDnsmasq" ] [ "networking" "networkmanager" "dns" ]) (mkRenamedOptionModule [ "networking" "networkmanager" "useDnsmasq" ] [ "networking" "networkmanager" "dns" ])
(mkRenamedOptionModule [ "networking" "connman" ] [ "services" "connman" ]) (mkRenamedOptionModule [ "networking" "connman" ] [ "services" "connman" ])
(mkRenamedOptionModule [ "networking" "defaultMailServer" ] [ "services" "ssmtp" ])
(mkRenamedOptionModule [ "services" "ssmtp" "directDelivery" ] [ "services" "ssmtp" "enable" ])
(mkChangedOptionModule [ "services" "printing" "gutenprint" ] [ "services" "printing" "drivers" ] (mkChangedOptionModule [ "services" "printing" "gutenprint" ] [ "services" "printing" "drivers" ]
(config: (config:
let enabled = getAttrFromPath [ "services" "printing" "gutenprint" ] config; let enabled = getAttrFromPath [ "services" "printing" "gutenprint" ] config;

View file

@ -9,8 +9,8 @@ import ./make-test.nix ({ lib, ... }:
{ {
services.mailcatcher.enable = true; services.mailcatcher.enable = true;
networking.defaultMailServer.directDelivery = true; services.ssmtp.enable = true;
networking.defaultMailServer.hostName = "localhost:1025"; services.ssmtp.hostName = "localhost:1025";
environment.systemPackages = [ pkgs.mailutils ]; environment.systemPackages = [ pkgs.mailutils ];
}; };