Skip to content

Instantly share code, notes, and snippets.

@maralorn
Created August 12, 2019 00:48
Show Gist options
  • Save maralorn/056e63636c7a155655c7dd78bbffd220 to your computer and use it in GitHub Desktop.
Save maralorn/056e63636c7a155655c7dd78bbffd220 to your computer and use it in GitHub Desktop.
{ pkgs, config, ... }:
let
email2matrix = pkgs.callPackage ./email2matrix.nix {};
default_mailbox = {
MailboxName = "<missing>";
MatrixRoomId = "<missing>";
MatrixHomeserverUrl = "https://matrix.maralorn.de";
MatrixUserId = "@marabot:matrix.maralorn.de";
MatrixAccessToken = config.m-0.private.matrix_marabot_token;
IgnoreSubject = false;
IgnoreBody = false;
SkipMarkdown = false;
};
email2matrix-config = pkgs.writeText "email2matrix-config.json"
(builtins.toJSON {
Smtp = {
ListenInterface = "[::1]:2525";
Hostname = "email2matrix.maralorn.de";
Workers = 10;
};
Matrix = {
Mappings = [
(default_mailbox // {
MailboxName = "monitoring";
MatrixRoomId = "!negVsngnYOmXYCLKiO:maralorn.de";
})
];
};
Misc = { Debug = true; };
});
in {
systemd.services.email2matrix = {
script =
"${email2matrix}/bin/devture-email2matrix --config ${email2matrix-config}";
wantedBy = [ "multi-user.target" ];
};
}
{ buildGoModule, fetchFromGitHub, ... }:
buildGoModule rec {
name = "email2matrix";
version = "782bcfdd67983ff27f0b9cec5c81cf1a20796ab0";
src = fetchFromGitHub {
owner = "devture";
repo = "email2matrix";
rev = version;
sha256 = "0nx99iab2y10m4jh4jl9c4y7j4iy8zlyfcn42v4y4mlk1507czlj";
};
modSha256 = "0nrl1d1628isd6183a9rj4qmsmzpbsf656cm75vw0lz2x0s4x7dg";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment