diff --git a/flake.nix b/flake.nix index 002db950..441f25c1 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,6 @@ }; outputs = { - self, nixpkgs, home-manager, stylix, @@ -210,6 +209,7 @@ ]; homeModules = [ ./home/hyprland/default.nix + ./home/email/work.nix ]; }; @@ -221,6 +221,7 @@ ]; homeModules = [ ./home/hyprland/default.nix + ./home/email/work.nix ]; }; }; diff --git a/home/email/default.nix b/home/email/default.nix index da86985d..5267545d 100644 --- a/home/email/default.nix +++ b/home/email/default.nix @@ -1,6 +1,4 @@ { - config, - lib, pkgs, hostName, ... @@ -15,7 +13,7 @@ tls.enable = false; in rec { inherit realName; - primary = lib.mkDefault true; + primary = true; maildir.path = "Proton"; imap = { inherit host tls; @@ -29,16 +27,16 @@ aliases = ["evie@xenia.me.uk" "evie@litherlandsmith.slmail.me"]; userName = address; passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostName}/proton | head -n1"; - mu.enable = lib.mkDefault true; + mu.enable = true; msmtp = { - enable = mu.enable; + enable = true; extraConfig = { tls = "off"; auth = "login"; }; }; mbsync = { - enable = mu.enable; + enable = true; create = "both"; expunge = "both"; remove = "both"; @@ -49,17 +47,17 @@ }; icloud = rec { inherit realName; - primary = lib.mkDefault false; + primary = false; maildir.path = "iCloud"; imap.host = "imap.mail.me.com"; smtp.host = "smtp.mail.me.com"; address = "e.litherlandsmith@icloud.com"; userName = address; passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostName}/icloud | head -n1"; - mu.enable = lib.mkDefault true; - msmtp.enable = mu.enable; + mu.enable = true; + msmtp.enable = true; mbsync = { - enable = mu.enable; + enable = true; create = "both"; expunge = "both"; remove = "both"; @@ -67,50 +65,6 @@ subFolders = "Verbatim"; }; }; - outlook = let - host = "127.0.0.1"; - tls.enable = false; - in rec { - inherit realName; - primary = lib.mkDefault false; - maildir.path = "Outlook"; - imap = { - inherit host tls; - port = 1144; - }; - smtp = { - inherit host tls; - port = 1026; - }; - address = "evie.litherland-smith@ukaea.uk"; - aliases = ["elitherl@jet.uk"]; - userName = address; - passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostName}/outlook | head -n1"; - mu.enable = lib.mkDefault false; - msmtp = { - enable = mu.enable; - extraConfig = { - tls = "off"; - auth = "login"; - }; - }; - mbsync = { - enable = mu.enable; - create = "both"; - expunge = "both"; - remove = "both"; - patterns = [ - "*" - "!Conversation History" - "!Snoozed" - "!Social Activity Notifications" - "!Sync Issues*" - "!Unsent Messages" - ]; - subFolders = "Verbatim"; - extraConfig.account.AuthMechs = "LOGIN"; - }; - }; }; }; programs = { @@ -121,28 +75,7 @@ groups.inboxes = { proton = ["INBOX"]; icloud = ["INBOX"]; - outlook = ["INBOX"]; }; }; }; - systemd.user.services = let - emailAccounts = config.accounts.email.accounts; - in { - davmail = lib.mkIf emailAccounts.outlook.mbsync.enable { - Unit = { - Description = "Davmail server"; - Wants = ["network-online.target"]; - After = ["network-online.target"]; - }; - Service = { - Environment = ["PATH=/run/current-system/sw/bin/:$PATH"]; - Restart = "always"; - ExecStartPre = with config.home; '' - /bin/sh -c "if [ ! -f ${homeDirectory}/.davmail.properties ]; then cp ${./.davmail.properties} ${homeDirectory}/.davmail.properties; fi; chmod 644 ${homeDirectory}/.davmail.properties" - ''; - ExecStart = "${pkgs.davmail}/bin/davmail -notray ${config.home.homeDirectory}/.davmail.properties"; - }; - Install.WantedBy = ["default.target"]; - }; - }; } diff --git a/home/email/work.nix b/home/email/work.nix new file mode 100644 index 00000000..3e830477 --- /dev/null +++ b/home/email/work.nix @@ -0,0 +1,69 @@ +{ + config, + pkgs, + hostName, + ... +}: { + imports = [./default.nix]; + accounts.email.accounts.outlook = let + host = "127.0.0.1"; + tls.enable = false; + in rec { + inherit (config.accounts.email.accounts.proton) realName; + primary = false; + maildir.path = "Outlook"; + imap = { + inherit host tls; + port = 1144; + }; + smtp = { + inherit host tls; + port = 1026; + }; + address = "evie.litherland-smith@ukaea.uk"; + aliases = ["elitherl@jet.uk"]; + userName = address; + passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostName}/outlook | head -n1"; + mu.enable = true; + msmtp = { + enable = true; + extraConfig = { + tls = "off"; + auth = "login"; + }; + }; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + remove = "both"; + patterns = [ + "*" + "!Conversation History" + "!Snoozed" + "!Social Activity Notifications" + "!Sync Issues*" + "!Unsent Messages" + ]; + subFolders = "Verbatim"; + extraConfig.account.AuthMechs = "LOGIN"; + }; + }; + programs.mbsync.groups.inboxes.outlook = ["INBOX"]; + systemd.user.services.davmail = { + Unit = { + Description = "Davmail server"; + Wants = ["network-online.target"]; + After = ["network-online.target"]; + }; + Service = { + Environment = ["PATH=/run/current-system/sw/bin/:$PATH"]; + Restart = "always"; + ExecStartPre = with config.home; '' + /bin/sh -c "if [ ! -f ${homeDirectory}/.davmail.properties ]; then cp ${./.davmail.properties} ${homeDirectory}/.davmail.properties; fi; chmod 644 ${homeDirectory}/.davmail.properties" + ''; + ExecStart = "${pkgs.davmail}/bin/davmail -notray ${config.home.homeDirectory}/.davmail.properties"; + }; + Install.WantedBy = ["default.target"]; + }; +} diff --git a/hosts/Ronin/home.nix b/hosts/Ronin/home.nix index 59466be0..11a61f40 100644 --- a/hosts/Ronin/home.nix +++ b/hosts/Ronin/home.nix @@ -1,16 +1,14 @@ { config, + lib, pkgs, ... }: { home.packages = [(pkgs.writeShellScriptBin "ukaea-vpn-connect" "sudo ${pkgs.openfortivpn}/bin/openfortivpn -c ${./ukaea-vpn.conf}")]; programs.git.userEmail = config.accounts.email.accounts.outlook.address; accounts.email.accounts = { - proton.primary = false; - outlook = { - primary = true; - mu.enable = true; - }; + proton.primary = lib.mkForce false; + outlook.primary = lib.mkForce true; }; wayland.windowManager.hyprland.settings = { misc.force_default_wallpaper = 0;