summaryrefslogtreecommitdiffstats
path: root/lass/2configs/muchsync.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-01-27 22:57:15 +0100
committermakefu <github@syntax-fehler.de>2021-01-27 22:57:15 +0100
commit144edeee1030d647bcc64083efc5834d1628341d (patch)
tree92f32df8dbc09b1bc36061267967b605628409b7 /lass/2configs/muchsync.nix
parent9c6c20f69e7b76e4231ffeae715d2ee5d453bb4d (diff)
parenta2ca5f2e214be259fdb0f9ea92b79d74e6216a51 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/2configs/muchsync.nix')
-rw-r--r--lass/2configs/muchsync.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/lass/2configs/muchsync.nix b/lass/2configs/muchsync.nix
new file mode 100644
index 000000000..b09bf579b
--- /dev/null
+++ b/lass/2configs/muchsync.nix
@@ -0,0 +1,40 @@
+with (import <stockholm/lib>);
+{ config, pkgs, ... }:
+
+{
+ systemd.services.muchsync = let
+ hosts = [
+ "mors.r"
+ "green.r"
+ "blue.r"
+ ];
+ in {
+ description = "sync mails";
+ environment = {
+ NOTMUCH_CONFIG = config.environment.variables.NOTMUCH_CONFIG;
+ };
+ after = [ "network.target" ];
+
+ restartIfChanged = false;
+
+ path = [
+ pkgs.notmuch
+ pkgs.openssh
+ ];
+
+ startAt = "*:*"; # run every minute
+ serviceConfig = {
+ User = "lass";
+ Type = "oneshot";
+ ExecStart = pkgs.writeDash "sync-mails" ''
+ set -euf
+
+ /run/current-system/sw/bin/nm-tag-init 2>/dev/null
+ ${concatMapStringsSep "\n" (host: ''
+ echo syncing ${host}:
+ ${pkgs.muchsync}/bin/muchsync -s 'ssh -CTaxq -o ConnectTimeout=4' --nonew lass@${host} || :
+ '') hosts}
+ '';
+ };
+ };
+}