mu: allow aliases to be used by mu configuration file

This has no effect if the user does not have any aliases defined for
any accounts.

This will also only add `--my-address=` to only accounts that are
enabled to be tracked by mu.
This commit is contained in:
Karl Hallsby 2022-02-21 21:24:27 -06:00 committed by Robert Helgesson
parent 5d4327cff4
commit da92196a95
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 31 additions and 3 deletions

View file

@ -12,12 +12,14 @@ let
# Takes the list of accounts with mu.enable = true, and generates a
# command-line flag for initializing the mu database.
myAddresses = let
# List of account sets where mu.enable = true.
# Set of email account sets where mu.enable = true.
muAccounts =
filter (a: a.mu.enable) (attrValues config.accounts.email.accounts);
addrs = map (a: a.address) muAccounts;
# Prefix --my-address= to each account's address with mu.enable.
addMyAddress = map (addr: "--my-address=" + addr) addrs;
# Construct list of lists containing email aliases, and flatten
aliases = flatten (map (a: a.aliases) muAccounts);
# Prefix --my-address= to each account's address AND all defined aliases
addMyAddress = map (addr: "--my-address=" + addr) (addrs ++ aliases);
in concatStringsSep " " addMyAddress;
in {