mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-02 19:49:18 +00:00
Add programs.astroid.settings for native JSON configuration and generate the configuration file from it. The extraConfig and externalEditor options become deprecated aliases into settings. Home Manager no longer writes its bundled template; Astroid's built-in defaults match it except editor.markdown_processor. Astroid accounts still supply account settings, the notmuch path, and the GPG path as per-key defaults. Empty settings write no file. externalEditor now merges at ordinary priority instead of replacing the editor keys, and priorities on extraConfig sections apply to the section as a unit. The release notes describe both changes.
58 lines
1.9 KiB
Nix
58 lines
1.9 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
imports = [ ../../accounts/email-test-accounts.nix ];
|
|
|
|
accounts.email.accounts."hm@example.com" = {
|
|
astroid.enable = true;
|
|
notmuch.enable = true;
|
|
msmtp.enable = true;
|
|
signature = {
|
|
showSignature = "attach";
|
|
text = "Test signature";
|
|
};
|
|
gpg = {
|
|
key = "test-key";
|
|
signByDefault = true;
|
|
};
|
|
astroid.extraConfig.select_query = "tag:inbox";
|
|
};
|
|
|
|
programs.astroid = {
|
|
enable = true;
|
|
pollScript = "fetch-mail";
|
|
};
|
|
|
|
assertions = [
|
|
{
|
|
assertion = lib.elem config.programs.astroid.package config.home.packages;
|
|
message = "Astroid must install its configured package.";
|
|
}
|
|
];
|
|
|
|
test.asserts.warnings.expected = [ ];
|
|
|
|
nmt.script = ''
|
|
assertFileContent "$(normalizeStorePaths home-files/.config/astroid/config)" ${./controls.json}
|
|
assertFileExists home-files/.config/astroid/poll.sh
|
|
assertFileContains home-files/.config/astroid/poll.sh 'fetch-mail'
|
|
test -x "$TESTED/home-files/.config/astroid/poll.sh"
|
|
${pkgs.jq}/bin/jq -e '
|
|
.accounts["hm@example.com"] as $account
|
|
| $account.sendmail == "msmtpq --read-envelope-from --read-recipients"
|
|
and $account.email == "hm@example.com" and $account.default == "true"
|
|
and $account.signature_attach == "true" and $account.signature_default_on == "true"
|
|
and $account.signature_file_markdown == "false" and $account.signature_separate == "true"
|
|
and $account.gpgkey == "test-key" and $account.always_gpg_sign == "true"
|
|
and $account.select_query == "tag:inbox"
|
|
and (.accounts | keys) == ["hm@example.com"]
|
|
' "$TESTED/home-files/.config/astroid/config"
|
|
signature=$(${pkgs.jq}/bin/jq -r '.accounts["hm@example.com"].signature_file' "$TESTED/home-files/.config/astroid/config")
|
|
diff -u "$signature" ${pkgs.writeText "expected-signature" "Test signature"}
|
|
'';
|
|
}
|