From d618f52cda36f62b3744aa84422b4c9f28bdc61d Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 23 Jan 2021 18:43:55 +0100 Subject: l: add missing muchsync.nix --- lass/2configs/muchsync.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lass/2configs/muchsync.nix (limited to 'lass/2configs') 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 ); +{ 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} + ''; + }; + }; +} -- cgit v1.2.3