about summary refs log tree commit diff
path: root/home/profiles
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-02-14 23:59:40 +0900
committersefidel <contact@sefidel.net>2022-02-14 23:59:40 +0900
commit945418bebffca98f658e726da3100a5b4a6bb51c (patch)
treefe53bb3b710cab199f116f017ac63edc1a3dfc3d /home/profiles
parent46715ed381535bdd38e516467e8af4ec74d977d9 (diff)
downloadnixrc-945418bebffca98f658e726da3100a5b4a6bb51c.tar.gz
nixrc-945418bebffca98f658e726da3100a5b4a6bb51c.zip
chore: fix mail oneshot
Diffstat (limited to 'home/profiles')
-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