~misterio/nix-config

8d0dfaf70398d120eee7f7160793469e59b1e2ee — Gabriel Fontes 2 months ago 4b73bab
home/vdirsyncer: add systemd timer
1 files changed, 22 insertions(+), 0 deletions(-)

M home/misterio/trusted/vdirsyncer.nix
M home/misterio/trusted/vdirsyncer.nix => home/misterio/trusted/vdirsyncer.nix +22 -0
@@ 47,4 47,26 @@ in {
    username = "hi@m7.rs"
    password.fetch = ["command", "${pass}", "mail.m7.rs/hi@m7.rs"]
  '';

  systemd.user.services.vdirsyncer = {
    Unit = { Description = "vdirsyncer synchronization"; };
    Service =
      let keyring = import ./keyring.nix { inherit pkgs; };
      in
      {
        Type = "oneshot";
        ExecCondition = ''
          /bin/sh -c "${keyring.isUnlocked}"
        '';
        ExecStart = "${vdirsyncer} sync";
      };
  };
  systemd.user.timers.vdirsyncer = {
    Unit = { Description = "Automatic vdirsyncer synchronization"; };
    Timer = {
      OnBootSec = "30";
      OnUnitActiveSec = "5m";
    };
    Install = { WantedBy = [ "timers.target" ]; };
  };
}