From 5002c881f7bde33a235db62a5df30b89513f385d Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 12 Mar 2023 17:07:41 -0400 Subject: [PATCH] fix: mail not syncing read and deleted --- flake.nix | 2 ++ hosts/swan/default.nix | 1 - modules/common/mail/aerc.nix | 5 +++++ modules/common/mail/default.nix | 20 ++++++++++++++------ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index 93035b8..0280f2d 100644 --- a/flake.nix +++ b/flake.nix @@ -111,6 +111,8 @@ gitName = fullName; gitEmail = "7386960+nmasur@users.noreply.github.com"; mail.server = "noahmasur.com"; + mail.imapHost = "imap.purelymail.com"; + mail.smtpHost = "smtp.purelymail.com"; dotfilesRepo = "git@github.com:nmasur/dotfiles"; }; diff --git a/hosts/swan/default.nix b/hosts/swan/default.nix index 07e9452..30a1f7c 100644 --- a/hosts/swan/default.nix +++ b/hosts/swan/default.nix @@ -12,7 +12,6 @@ nixpkgs.lib.nixosSystem { ./hardware-configuration.nix ../../modules/common ../../modules/nixos - (removeAttrs globals [ "mail.server" ]) wsl.nixosModules.wsl home-manager.nixosModules.home-manager disko.nixosModules.disko diff --git a/modules/common/mail/aerc.nix b/modules/common/mail/aerc.nix index c85d62b..7960dff 100644 --- a/modules/common/mail/aerc.nix +++ b/modules/common/mail/aerc.nix @@ -181,6 +181,11 @@ }; }; + xdg.desktopEntries.aerc = lib.mkIf pkgs.stdenv.isLinux { + name = "aerc"; + exec = "kitty aerc %u"; + }; + programs.fish.shellAbbrs = { ae = "aerc"; }; }; diff --git a/modules/common/mail/default.nix b/modules/common/mail/default.nix index f0f0ccd..56c667b 100644 --- a/modules/common/mail/default.nix +++ b/modules/common/mail/default.nix @@ -10,9 +10,17 @@ default = config.user; }; mail.server = lib.mkOption { - type = lib.types.str; + type = lib.types.nullOr lib.types.str; description = "Server name for the email address."; }; + mail.imapHost = lib.mkOption { + type = lib.types.nullOr lib.types.str; + description = "Server host for IMAP (reading mail)."; + }; + mail.smtpHost = lib.mkOption { + type = lib.types.nullOr lib.types.str; + description = "Server host for SMTP (sending mail)."; + }; }; config = lib.mkIf config.mail.enable { @@ -42,7 +50,7 @@ folders = { }; getmail = { }; imap = { - host = "imap.purelymail.com"; + host = config.mail.imapHost; port = 993; tls.enable = true; }; @@ -55,9 +63,9 @@ maildir = { path = "main"; }; mbsync = { enable = true; - create = "maildir"; - expunge = "none"; - remove = "none"; + create = "both"; + expunge = "both"; + remove = "both"; patterns = [ "*" ]; extraConfig.channel = { CopyArrivalDate = "yes"; # Sync time of original message @@ -70,7 +78,7 @@ builtins.toString ../../../private/mailpass.age }"; smtp = { - host = "smtp.purelymail.com"; + host = config.mail.smtpHost; port = 465; tls.enable = true; };