From 3fe2a57b95333659e2ecdeeca3f4009bcf3b30cf Mon Sep 17 00:00:00 2001
From: MaxSchlueter <me@maxschlueter.com>
Date: Tue, 19 Jan 2021 18:36:31 +0000
Subject: [PATCH] mu: fix command (#1623)

mu-cfind is meant to search for contacts within your contacts database and the emails that you have sent/received. The use of the --personal flag in that command is meant to filter for only emails that use your email addresses (which are all the ones you specify with the ${myAddresses} variable. Disregard what I said in #1623 (comment).

--my-address=<my-email-address>

    specifies that some e-mail addresses are 'my-address' (--my-address can be used multiple times).
    This is used by mu cfind -- any e-mail address found in the address fields of a message which also
    has <my-email-address> in one of its address fields is considered a personal e-mail address. This
    allows you, for example, to filter out (mu cfind --personal) addresses which were merely seen in
    mailing list messages.

To initialize the database with mu init, the ${myAddresses} is not required to be passed to successfully initialize the database, but it is heavily recommended to do so.

To see the difference, in a safe location, run mu init --maildir=<path>, then mu index. You'll notice that "personal addresses" returns <none>, although the database will still work. However, mu cfind --personal will fail (as the personal contacts don't exist). Then run mu init --maildir=<path> --my-address=<address>, then mu index. Then you'll be able to search for contacts using mu cfind --personal.
---
 modules/programs/mu.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/programs/mu.nix b/modules/programs/mu.nix
index 18c3993a1..233624d14 100644
--- a/modules/programs/mu.nix
+++ b/modules/programs/mu.nix
@@ -50,7 +50,7 @@ in {
       # In theory, mu is the only thing that creates that directory, and it is
       # only created during the initial index.
       if [[ ! -d "${dbLocation}" ]]; then
-        $DRY_RUN_CMD mu init ${maildirOption} $VERBOSE_ARG;
+        $DRY_RUN_CMD mu init ${maildirOption} ${myAddresses} $VERBOSE_ARG;
       fi
     '';
   };