Migrate mailhog
Install via nix package. Also configure with custom module, inspired by nix os module. Bind hard to localhost, do not listen to outer world.
This commit is contained in:
parent
2ab2fb414a
commit
c372dacc8c
2
home.nix
2
home.nix
|
@ -4,6 +4,7 @@
|
|||
imports = [
|
||||
./home/modules/programs/cmus.nix
|
||||
./home/modules/programs/languagetool.nix
|
||||
./home/modules/programs/mailhog.nix
|
||||
];
|
||||
|
||||
# Home Manager needs a bit of information about you and the
|
||||
|
@ -87,5 +88,6 @@
|
|||
};
|
||||
|
||||
services.dunst = import ./home/services/dunst.nix;
|
||||
services.mailhog.enable = true;
|
||||
services.languagetool.enable = true;
|
||||
}
|
||||
|
|
71
home/modules/programs/mailhog.nix
Normal file
71
home/modules/programs/mailhog.nix
Normal file
|
@ -0,0 +1,71 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.mailhog;
|
||||
|
||||
args = lib.concatStringsSep " " (
|
||||
[
|
||||
"-api-bind-addr 127.0.0.1:${toString cfg.apiPort}"
|
||||
"-smtp-bind-addr 127.0.0.1:${toString cfg.smtpPort}"
|
||||
"-ui-bind-addr 127.0.0.1:${toString cfg.uiPort}"
|
||||
"-storage ${cfg.storage}"
|
||||
] ++ lib.optional (cfg.storage == "maildir")
|
||||
"-maildir-path $STATE_DIRECTORY"
|
||||
++ cfg.extraArgs
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
options.services.mailhog = {
|
||||
enable = mkEnableOption "MailHog";
|
||||
|
||||
storage = mkOption {
|
||||
type = types.enum [ "maildir" "memory" ];
|
||||
default = "memory";
|
||||
description = "Store mails on disk or in memory.";
|
||||
};
|
||||
|
||||
apiPort = mkOption {
|
||||
type = types.port;
|
||||
default = 8025;
|
||||
description = "Port on which the API endpoint will listen.";
|
||||
};
|
||||
|
||||
smtpPort = mkOption {
|
||||
type = types.port;
|
||||
default = 1025;
|
||||
description = "Port on which the SMTP endpoint will listen.";
|
||||
};
|
||||
|
||||
uiPort = mkOption {
|
||||
type = types.port;
|
||||
default = 8025;
|
||||
description = "Port on which the HTTP UI will listen.";
|
||||
};
|
||||
|
||||
extraArgs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "List of additional arguments to pass to the MailHog process.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.mailhog = {
|
||||
Unit = {
|
||||
Description = "MailHog - Web and API based SMTP testing";
|
||||
};
|
||||
|
||||
Service = {
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${pkgs.mailhog}/bin/MailHog ${args}";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -91,8 +91,6 @@ Todos
|
|||
|
||||
No particular order:
|
||||
|
||||
* Migrate mailhog (manually installed right now)
|
||||
|
||||
* Migrate neovim
|
||||
|
||||
* Migrate ssh config (I don't really like to expose customer server names and configs to outer world, how to handle?)
|
||||
|
|
Loading…
Reference in a new issue