mu: allow option to set muhome

Allows for the database path for mu to be configured. Useful for keeping
the maildir and mu xapian cache together without having to modify
XDG_CACHE_HOME. Add test to check for custom home setting.

Fixes #5534
This commit is contained in:
Nova Leary 2025-01-21 06:14:48 -06:00 committed by GitHub
parent 0b8df9eeb6
commit bb14224f51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 5 deletions

View file

@ -19,6 +19,6 @@
'if [[ ! -d "/home/hm-user/.cache/mu" || ! "$MU_SORTED_ADDRS" = "foo@example.com hm@example.com" ]]; then'
assertFileContains activate \
'run @mu@/bin/mu init --maildir=/home/hm-user/Mail --my-address=foo@example.com --my-address=hm@example.com $VERBOSE_ARG;'
'run @mu@/bin/mu init --maildir=/home/hm-user/Mail --muhome "/home/hm-user/.cache/mu" --my-address=foo@example.com --my-address=hm@example.com $VERBOSE_ARG;'
'';
}

View file

@ -0,0 +1,25 @@
{ config, ... }: {
imports = [ ../../accounts/email-test-accounts.nix ];
accounts.email.accounts = {
"hm@example.com" = {
mu.enable = true;
aliases = [ "foo@example.com" ];
};
};
programs.mu = {
enable = true;
home = config.xdg.dataHome + "/mu";
};
test.stubs.mu = { name = "mu"; };
nmt.script = ''
assertFileContains activate \
'if [[ ! -d "/home/hm-user/.local/share/mu" || ! "$MU_SORTED_ADDRS" = "foo@example.com hm@example.com" ]]; then'
assertFileContains activate \
'run @mu@/bin/mu init --maildir=/home/hm-user/Mail --muhome "/home/hm-user/.local/share/mu" --my-address=foo@example.com --my-address=hm@example.com $VERBOSE_ARG;'
'';
}

View file

@ -1 +1,4 @@
{ mu-basic-configuration = ./basic-configuration.nix; }
{
mu-basic-configuration = ./basic-configuration.nix;
mu-custom-configuration = ./custom-configuration.nix;
}