shack/muell_mail: init

This commit is contained in:
makefu 2019-07-12 17:20:54 +02:00
parent cf81f41a90
commit 80ed71e9b8
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
let
pkg = pkgs.callPackage (
pkgs.fetchgit {
url = "https://git.shackspace.de/rz/muell_mail";
rev = "317370e3e98ce34da4ee615af7a80df7b519ab89";
sha256 = "sha256:02mywm37n0v4icgy474wwkavb7vad93bvkigvz1cqn7fbg4ldc8k";
}) {};
home = "/var/lib/muell_mail";
cfg = toString <secrets/shack/muell_mail.js>;
in {
users.users.muell_mail = {
inherit home;
createHome = true;
};
systemd.services.muell_mail = {
description = "muell_mail";
wantedBy = [ "multi-user.target" ];
environment.CONFIG = "${home}/muell_mail.js";
serviceConfig = {
User = "muell_mail";
ExecStartPre = pkgs.writeDash "muell_mail-pre" ''
install -D -omuell_mail -m700 ${cfg} ${home}/muell_mail.js
'';
WorkingDirectory = home;
PermissionsStartOnly = true;
ExecStart = "${pkg}/bin/muell_mail";
Restart = "always";
PrivateTmp = true;
};
};
}