about summary refs log tree commit diff
path: root/home/profiles/messaging/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home/profiles/messaging/default.nix')
-rw-r--r--home/profiles/messaging/default.nix38
1 files changed, 18 insertions, 20 deletions
diff --git a/home/profiles/messaging/default.nix b/home/profiles/messaging/default.nix
index 54d6870..946bcb8 100644
--- a/home/profiles/messaging/default.nix
+++ b/home/profiles/messaging/default.nix
@@ -41,8 +41,6 @@ in
           boxes = [ "Inbox" ];
           onNotify = pkgs.writeShellScript "imap-on-notify" ''
             ${mbsyncCmd} zach
-            NOTMUCH_CONFIG=${lib.escapeShellArg config.home.sessionVariables.NOTMUCH_CONFIG}
-            NMBGIT=${lib.escapeShellArg config.home.sessionVariables.NMBGIT}
             ${pkgs.notmuch}/bin/notmuch new
           '';
         };
@@ -183,21 +181,22 @@ in
     services.imapnotify.enable = true;
 
     # Sync emails on initial login
-    systemd.user.services.mbsync-initial = {
+    systemd.user.services.mbsync-oneshot = {
       Unit = {
-        Description = "mbsync initial synchronisation";
-        After = "graphical-session.target";
+        Description = "mbsync oneshot synchronisation";
       };
       Service = {
+        Type = "oneshot";
         ExecStart = "${mbsyncCmd} --all";
-        Restart = "on-failure";
+        RemainAfterExit = true;
       };
       Install.WantedBy = [ "default.target" ];
     };
 
-    home.file.".mailcap".text = let
-      setsid = "${pkgs.util-linux}/bin/setsid";
-      openfile = "${pkgs.writeShellScript "openfile" ''
+    home.file.".mailcap".text =
+      let
+        setsid = "${pkgs.util-linux}/bin/setsid";
+        openfile = "${pkgs.writeShellScript "openfile" ''
         # Helps open a file with xdg-open from mutt in a external program without weird side effects.
         tempdir="''${TMPDIR:-$(mktemp -d)}"
         file="$tempdir/$(basename "$1")"
@@ -207,17 +206,16 @@ in
         $opener "$file" >/dev/null 2>&1
         find "''${tempdir:?}" -mtime +1 -type f -delete
       ''}";
-    in ''
-      ${lib.optionalString false "text/html; ${pkgs.w3m}/bin/w3m -dump -T text/html -I %{charset} -O utf-8 %s; copiousoutut; description=HTML Text; nametemplate=%s.html"}
-
-
-      text/plain; $EDITOR %s ;
-      ${lib.optionalString true "text/html; ${openfile} %s ; nametemplate=%s.html"}
-      text/html; ${pkgs.lynx}/bin/lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput;
-      image/*; ${openfile} %s ;
-      application/pdf; ${openfile} %s ;
-      # application/pgp-encrypted; gpg -d '%s'; copiousoutput;
-    '';
+      in
+      ''
+        ${lib.optionalString false "text/html; ${pkgs.w3m}/bin/w3m -dump -T text/html -I %{charset} -O utf-8 %s; copiousoutut; description=HTML Text; nametemplate=%s.html"}
+        text/plain; $EDITOR %s ;
+        ${lib.optionalString true "text/html; ${openfile} %s ; nametemplate=%s.html"}
+        text/html; ${pkgs.lynx}/bin/lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput;
+        image/*; ${openfile} %s ;
+        application/pdf; ${openfile} %s ;
+        # application/pgp-encrypted; gpg -d '%s'; copiousoutput;
+      '';
 
     home.packages = with pkgs; [
       element-desktop