summary refs log tree commit diff
path: root/nixos/modules/services/mail
diff options
context:
space:
mode:
authorSamuel Leathers <disasm@gmail.com>2017-06-24 12:05:34 -0400
committerJörg Thalheim <Mic92@users.noreply.github.com>2017-06-24 17:05:34 +0100
commit5d7fd7e7fa2a488d6df92da30933c27aad7530b6 (patch)
tree29cc6150f223f5268719f8052d93c947f6ff9c63 /nixos/modules/services/mail
parentda1525260bc88107335611043d6ded77b09e5149 (diff)
downloadnixlib-5d7fd7e7fa2a488d6df92da30933c27aad7530b6.tar
nixlib-5d7fd7e7fa2a488d6df92da30933c27aad7530b6.tar.gz
nixlib-5d7fd7e7fa2a488d6df92da30933c27aad7530b6.tar.bz2
nixlib-5d7fd7e7fa2a488d6df92da30933c27aad7530b6.tar.lz
nixlib-5d7fd7e7fa2a488d6df92da30933c27aad7530b6.tar.xz
nixlib-5d7fd7e7fa2a488d6df92da30933c27aad7530b6.tar.zst
nixlib-5d7fd7e7fa2a488d6df92da30933c27aad7530b6.zip
mailhog: init at 1.0.0 (#26821)
* mailhog: init at 1.0.0

* formatting nitpicks
Diffstat (limited to 'nixos/modules/services/mail')
-rw-r--r--nixos/modules/services/mail/mailhog.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixos/modules/services/mail/mailhog.nix b/nixos/modules/services/mail/mailhog.nix
new file mode 100644
index 000000000000..206fb50d31a2
--- /dev/null
+++ b/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.extraUsers.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;
+      };
+    };
+  };
+}