2017-06-24 17:05:34 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.mailhog;
|
|
|
|
in {
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.mailhog = {
|
|
|
|
enable = mkEnableOption "MailHog";
|
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "mailhog";
|
|
|
|
description = "User account under which mailhog runs.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2018-06-30 00:58:35 +01:00
|
|
|
users.users.mailhog = {
|
2017-06-24 17:05:34 +01:00
|
|
|
name = cfg.user;
|
|
|
|
description = "MailHog service user";
|
2019-10-12 21:25:28 +01:00
|
|
|
isSystemUser = true;
|
2017-06-24 17:05:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.mailhog = {
|
|
|
|
description = "MailHog service";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
ExecStart = "${pkgs.mailhog}/bin/MailHog";
|
|
|
|
User = cfg.user;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|