From fc183208cf6e56905e51c7b88b96ab6d1ab74b1d Mon Sep 17 00:00:00 2001 From: Felix Suchert Date: Thu, 24 Oct 2024 11:47:20 -0400 Subject: [PATCH] add mailfetch service --- entropy/nixos/configuration.nix | 41 ++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/entropy/nixos/configuration.nix b/entropy/nixos/configuration.nix index a35a93e..d0d9657 100644 --- a/entropy/nixos/configuration.nix +++ b/entropy/nixos/configuration.nix @@ -376,21 +376,40 @@ ]; # periodic automated mail fetching - systemd.user.services.mailfetch = { - enable = true; - description = "Automatically fetches new mails."; - wantedBy = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; + systemd.user.services.mbsync = { + description = "Automated mail fetch and tagging"; serviceConfig = { - Restart = "always"; - RestartSec = "60"; + Type = "oneshot"; }; - path = with pkgs; [ bash notmuch isync ]; - script = '' - mbsync -a && /home/felix/.config/neomutt/notmuch-hook.sh - ''; + path = with pkgs; [ bash isync notmuch ]; + script = "mbsync -a"; + postStop = "/home/felix/.config/neomutt/notmuch-hook.sh"; }; + systemd.user.timers.mbsync = { + description = "Automated mail fetch and processing"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "10m"; + OnUnitInactiveSec = "10m"; + }; + }; + + # systemd.user.services.mailfetch = { + # enable = true; + # description = "Automatically fetches new mails."; + # wantedBy = [ "graphical-session.target" ]; + # after = [ "graphical-session.target" ]; + # serviceConfig = { + # Restart = "always"; + # RestartSec = "60"; + # }; + # path = with pkgs; [ bash notmuch isync ]; + # script = '' + # mbsync -a && /home/felix/.config/neomutt/notmuch-hook.sh + # ''; + # }; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave