* imapnotify: expose package (and exe) options
There are multiple packages that provide an imapnotify interface. Those
packages have differently named executables. This can now be customized.
This change also means test configurations can use stub packages.
* imapnotify: use/create config in configHome
Exposing the configuration file makes testing imapnotify configurations much
easier. It also allows for golden tests in home-manager.
* imapnotify: extend with launchd agent
Now that home-manager supports launchd agents, the imapnotify service
can be configured (and enabled) for darwin. The configuration matches
that of the linux/systemd version. In particular, by not setting a
`UserName`, this runs as the user whose configuration includes the
module.
Due to the launchd `Program` implementation (it must take an absolute
path) it is not possible to use that for the program and stub the path
in tests. Instead, this uses `ProgramArguments` for the program name.
The `ThrottleInterval` is equivalent to `RestartSec`. `KeepAlive` is
equivalent to `Restart`.
The `ExitTimeOut` default is 20 seconds, but goimapnotify should not
time out — this is achieved by setting the `ExitTimeout` to 0.
* imapnotify: add launchd plist test
This only tests the generated plist (which is new), not the original
systemd implementation, nor the json config file.
(Note the lack of a newline at the end of the plist file.)
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.
Before, loading a module would be guarded by an optional platform
condition. This made it possible to avoid loading and evaluating a
module if it did not support the host platform.
Unfortunately, this made it impossible to share a single configuration
between GNU/Linux and Darwin hosts, which some wish to do.
This removes the conditional load and instead inserts host platform
assertions in the modules that are platform specific.
Fixes#1906
I also made some modifications to the systemd service to match the [AUR version](https://aur.archlinux.org/cgit/aur.git/tree/goimapnotify@.service?h=goimapnotify) of `goimapnotify`. In particular, restarting is useful in case a network failure causes `imapnotify` to exit - that shouldn't mean that it stops trying when the network comes back up.