notmuch: fix database creation when using hooks

When an hook is defined, a side effect was the creation of the
${notmuchIni.database.path}/.notmuch/ directory by home-manager. If
the Xapian database does not exist yet but this .notmuch directory
exists, Notmuch is confused and throws an error when `notmuch new` is
run (while this should create the database the first time).

This commit changes the hooks paths to $XDG_CONFIG_HOME where Notmuch
expects them (see notmuch-config(1)) instead of inside the maildir
database directory.

It also moves the configuration where Notmuch expects it, but the
$NOTMUCH_CONFIG environment variable is kept for backward
compatibility.
This commit is contained in:
Thibaut Marty 2022-02-05 17:45:12 +01:00 committed by Robert Helgesson
parent 85bbc6cc12
commit 6d9d9294d0
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
5 changed files with 22 additions and 21 deletions

View file

@ -42,7 +42,8 @@ let
template = fromJSON (readFile ./astroid-config-template.json);
astroidConfig = foldl' recursiveUpdate template [
{
astroid.notmuch_config = "${config.xdg.configHome}/notmuch/notmuchrc";
astroid.notmuch_config =
"${config.xdg.configHome}/notmuch/default/config";
accounts = mapAttrs (n: accountAttr) astroidAccounts;
crypto.gpg.path = "${pkgs.gnupg}/bin/gpg";
}