From e0a178df252d6801108699fa07cd1ea494ebc12d Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 10 Feb 2019 19:59:18 +0000 Subject: config: give up on this experiment This ended up being way more trouble than it was worth, and the approach just flat out didn't work for stuff like OpenSSH. --- modules/workstation/mail/isync/default.nix | 56 +++++++++++++---------------- modules/workstation/mail/isync/mbsyncrc.nix | 26 ++++++++++++++ 2 files changed, 51 insertions(+), 31 deletions(-) create mode 100644 modules/workstation/mail/isync/mbsyncrc.nix (limited to 'modules/workstation/mail/isync') diff --git a/modules/workstation/mail/isync/default.nix b/modules/workstation/mail/isync/default.nix index 66343a0c3625..1ec41d8e13c2 100644 --- a/modules/workstation/mail/isync/default.nix +++ b/modules/workstation/mail/isync/default.nix @@ -1,36 +1,30 @@ -{ pkgs, options, ... }: +{ pkgs, config, ... }: -let - inherit (pkgs.pkgsConfigured) isync; -in { - config = - if options.environment ? "darwinConfig" then - { - launchd.user.agents.isync = { - serviceConfig.ProgramArguments = [ "${isync}/bin/mbsync" "Periodic" ]; - serviceConfig.StartInterval = 300; - serviceConfig.RunAtLoad = true; - }; - } - else - { - systemd.user.services.isync = { - serviceConfig = { - Type = "oneshot"; - ExecStart = '' - ${isync}/bin/mbsync Periodic - ''; - }; - }; +{ + environment.systemPackages = with pkgs; [ isync ]; - systemd.user.timers.isync = { - timerConfig = { - Unit = "isync.service"; - OnCalendar = "*:0/5"; - Persistent = "true"; - }; - wantedBy = [ "default.target" ]; - }; + systemd.services.isync = + let + mbsyncrc = pkgs.writeText "mbsyncrc" (import ./mbsyncrc.nix { + maildir = "${config.users.users.qyliss.home}/mail"; + }); + in { + serviceConfig = { + Type = "oneshot"; + User = "qyliss-mail"; + ExecStart = '' + ${pkgs.isync}/bin/mbsync -a -c ${mbsyncrc} + ''; }; + }; + + systemd.timers.isync = { + timerConfig = { + Unit = "isync.service"; + OnCalendar = "*:0/5"; + Persistent = "true"; + }; + wantedBy = [ "multi-user.target" ]; + }; } diff --git a/modules/workstation/mail/isync/mbsyncrc.nix b/modules/workstation/mail/isync/mbsyncrc.nix new file mode 100644 index 000000000000..3a093e35efb5 --- /dev/null +++ b/modules/workstation/mail/isync/mbsyncrc.nix @@ -0,0 +1,26 @@ +{ maildir }: + +'' +Create Both + +MaildirStore local + Path ${maildir}/ + Inbox ${maildir}/INBOX + Subfolders Verbatim + +IMAPAccount fastmail + Host imap.fastmail.com + User alyssa@fastmail.com + PassCmd "cat ~/imappass" + SSLType IMAPS + SSLVersions TLSv1.2 + +IMAPStore fastmail-remote + Account fastmail + +Channel fastmail + Master :fastmail-remote: + Slave :local: + Patterns * + SyncState * +'' -- cgit 1.4.1