diff options
Diffstat (limited to 'nixpkgs/nixos/modules/services/mail/mailhog.nix')
-rw-r--r-- | nixpkgs/nixos/modules/services/mail/mailhog.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/mail/mailhog.nix b/nixpkgs/nixos/modules/services/mail/mailhog.nix new file mode 100644 index 000000000000..b78f4c8e0e66 --- /dev/null +++ b/nixpkgs/nixos/modules/services/mail/mailhog.nix @@ -0,0 +1,43 @@ +{ 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 { + + users.users.mailhog = { + name = cfg.user; + description = "MailHog service user"; + }; + + systemd.services.mailhog = { + description = "MailHog service"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.mailhog}/bin/MailHog"; + User = cfg.user; + }; + }; + }; +} |