mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
44 lines
810 B
Nix
44 lines
810 B
Nix
|
{ 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;
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|