about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-02-13T18·32+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-02-13T18·32+0000
commit3677a7a39e47bd9d295ae63e3a40e6cf98947506 (patch)
tree547e2a50405cc75ed3b77e7a81c94f57c0ea4344
parent9fa97eab671a3a926851840c3398b914c40e7e56 (diff)
Begin supporting notmuch in Emacs
I'm borrowing from @tazjin's dotfiles, which are stored in Git on Borg. When you
call `nix-build ~/briefcase/mail`, result will output a systemd units, which you
should move to ~/.config/systemd/user/.

The path to `gmi`, which is Lieer's executable, exists in /nix/store, and you
can read it from the systemd unit file (i.e. lieer-google.service). Lieer
synchronizes notmuch with Gmail and Gmail with notmuch.

Here's a general sequence of commands that I ran to set everything up. Special
thank you to @tazjin for helping me with all of this. These steps are not
certified as a tutorial; I'm recalling them from memory. When I set this up
things didn't work as expected immediately and I had to troubleshoot.

```shell
> mkdir -p ~/mail/account.google
> cd ~/mail/account.google
> nix-env -iA nixpkgs.notmuch
> notmuch setup
> nix-build ~/briefcase/mail
> cp ./result/lieer-google.{service,timer} ~/.config/systemd/user
> rm ./result
> systemctl --user cat lieer-google
...copy the /nix/store path to gmi...
> notmuch new
> /nix/store/gmi init
...follow the OAuth login flow...
>
```

Unknowns?
- Do I need to call `systemctl --user start lieer-google` at startup? Or should
  I move these units to user/default.target.wants?
- Can I send email from notmuch?
- How do I use notmuch to delete email? To respond to emails? To do anything?

Todo:
- Once this configuration stabilizes, I should package everything with Nix.
-rw-r--r--configs/shared/.config/systemd/user/lieer-google.service7
-rw-r--r--configs/shared/.config/systemd/user/lieer-google.timer9
-rw-r--r--mail/default.nix6
3 files changed, 22 insertions, 0 deletions
diff --git a/configs/shared/.config/systemd/user/lieer-google.service b/configs/shared/.config/systemd/user/lieer-google.service
new file mode 100644
index 000000000000..2f79ed6ccaa8
--- /dev/null
+++ b/configs/shared/.config/systemd/user/lieer-google.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Lieer sync for account 'google'
+
+[Service]
+Type=oneshot
+ExecStart=/nix/store/n6c4pr4fyrsjfksspkapb7yqc6fzl166-corp-lieer/bin/gmi sync
+WorkingDirectory=%h/mail/account.google
diff --git a/configs/shared/.config/systemd/user/lieer-google.timer b/configs/shared/.config/systemd/user/lieer-google.timer
new file mode 100644
index 000000000000..a073da25ea82
--- /dev/null
+++ b/configs/shared/.config/systemd/user/lieer-google.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run lieer sync for account 'google'
+
+[Timer]
+OnActiveSec=1
+OnUnitActiveSec=120
+
+[Install]
+WantedBy=timers.target
diff --git a/mail/default.nix b/mail/default.nix
new file mode 100644
index 000000000000..d1b67b965626
--- /dev/null
+++ b/mail/default.nix
@@ -0,0 +1,6 @@
+{ depot ? import <depot> {}, ... }:
+
+let
+  inherit (builtins) fetchGit;
+  tazjdots = import (fetchGit "sso://user/tazjin/dotfiles") { pkgs = depot; };
+in tazjdots.services.lieer