1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-19 14:53:00 +00:00
home-manager/tests/modules/programs/aerc/oauth.nix
eulalia 18e74c2e02
aerc-accounts: improve logic for parsing XOAUTH2 URL params (#6530)
This commit fixes an issue in aerc-accounts that prevents oauth2
accounts from being generated from given parameters. It also allows
users to add XOAUTH2 credentials without having to add all four of
client_id, client_secret, token_endpoint, and scope. It further adds
tests for the XOAUTH2 config generation.
2025-02-26 07:59:40 -06:00

39 lines
1 KiB
Nix

{ config, pkgs, ... }: {
config = {
nmt.script = let
dir = if (pkgs.stdenv.isDarwin && !config.xdg.enable) then
"home-files/Library/Preferences/aerc"
else
"home-files/.config/aerc";
in ''
assertFileContent ${dir}/accounts.conf ${./oauth.expected}
'';
programs.aerc = {
enable = true;
extraConfig.general.unsafe-accounts-conf = true;
};
accounts.email.accounts = {
basic = {
realName = "Annie X. Hacker";
userName = "anniex";
address = "anniex@mail.invalid";
primary = true;
flavor = "outlook.office365.com";
aerc = rec {
enable = true;
imapAuth = "xoauth2";
smtpAuth = imapAuth;
imapOauth2Params = {
client_id = "9e5f94bc-e8a4-4e73-b8be-63364c29d753";
token_endpoint =
"https://login.microsoftonline.com/common/oauth2/v2.0/token";
};
smtpOauth2Params = imapOauth2Params;
};
};
};
};
}