This repository has no description
846 B
39 lines
1{ config, pkgs, ... }:
2
3{
4 systemd.services.muchsync = let
5 hosts = [
6 "coaxmetal.r"
7 "mors.r"
8 "green.r"
9 ];
10 in {
11 description = "sync mails";
12 environment = {
13 NOTMUCH_CONFIG = config.environment.variables.NOTMUCH_CONFIG;
14 };
15 after = [ "network.target" ];
16
17 restartIfChanged = false;
18
19 path = [
20 pkgs.notmuch
21 pkgs.openssh
22 ];
23
24 startAt = "*:*"; # run every minute
25 serviceConfig = {
26 User = "lass";
27 Type = "oneshot";
28 ExecStart = pkgs.writeDash "sync-mails" ''
29 set -euf
30
31 /run/current-system/sw/bin/nm-tag-init 2>/dev/null
32 ${concatMapStringsSep "\n" (host: ''
33 echo syncing ${host}:
34 ${pkgs.muchsync}/bin/muchsync -s 'ssh -CTaxq -o ConnectTimeout=4' --nonew lass@${host} || :
35 '') hosts}
36 '';
37 };
38 };
39}