{ pkgs, ... }: { users.users.charlotte.packages = [ pkgs.imapfilter ]; systemd.services.imapfilter = { description = "Filter IMAP mail"; wants = [ "network-online.target" ]; after = [ "network-online.target" ]; unitConfig.ConditionPathExists = "/home/charlotte/.config/imapfilter/config.lua"; serviceConfig = { Type = "oneshot"; User = "charlotte"; EnvironmentFile = "/var/secrets/imapfilter.env"; ExecStart = "${pkgs.imapfilter}/bin/imapfilter -c /home/charlotte/.config/imapfilter/config.lua"; }; }; systemd.timers.imapfilter = { wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "*:0/5"; Persistent = true; }; }; }