stockholm/krebs/2configs/shack/muell_mail.nix

37 lines
1.0 KiB
Nix
Raw Normal View History

2019-07-12 15:20:54 +00:00
{ config, lib, pkgs, ... }:
let
2019-10-15 12:35:56 +00:00
pkg = pkgs.callPackage (
2021-09-05 17:51:31 +00:00
pkgs.fetchFromGitHub {
owner = "shackspace";
repo = "muell_mail";
2020-09-18 08:59:05 +00:00
rev = "c3e43687879f95e01a82ef176fa15678543b2eb8";
sha256 = "0hgchwam5ma96s2v6mx2jfkh833psadmisjbm3k3153rlxp46frx";
}) { mkYarnPackage = pkgs.yarn2nix-moretea.mkYarnPackage; };
2019-07-12 15:20:54 +00:00
home = "/var/lib/muell_mail";
cfg = toString <secrets/shack/muell_mail.js>;
in {
users.users.muell_mail = {
inherit home;
2021-06-05 17:13:25 +00:00
isSystemUser = true;
2019-07-12 15:20:54 +00:00
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";
PrivateTmp = true;
2019-09-26 19:46:14 +00:00
Restart = "always";
RestartSec = "15";
2019-07-12 15:20:54 +00:00
};
};
}