mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
aerc: integrate accounts.email.accounts.<name>.signature options
This commit is contained in:
parent
83f978812c
commit
0c94fcaee7
7 changed files with 86 additions and 12 deletions
|
|
@ -3,6 +3,8 @@
|
|||
lib,
|
||||
confSections,
|
||||
confSection,
|
||||
writeText,
|
||||
writeShellScript,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
|
@ -288,11 +290,40 @@ in
|
|||
pgp-opportunistic-encrypt = account.gpg.encryptByDefault;
|
||||
};
|
||||
|
||||
signatureCfg =
|
||||
account:
|
||||
# TODO: aerc does not support attaching signatures yet.
|
||||
# Until someone needs it, we will just ignore it for now.
|
||||
if account.signature.showSignature == "append" then
|
||||
if account.signature.command != null then
|
||||
{
|
||||
signature-cmd = writeShellScript "aerc-signature.sh" (
|
||||
lib.concatStringsSep "\n" [
|
||||
''printf '%s\n' "${account.signature.delimiter}"''
|
||||
account.signature.command
|
||||
]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
signature-file = writeText "aerc-signature.txt" (
|
||||
lib.concatStringsSep "\n" [
|
||||
account.signature.delimiter
|
||||
account.signature.text
|
||||
]
|
||||
);
|
||||
}
|
||||
else
|
||||
{ };
|
||||
|
||||
in
|
||||
(basicCfg account)
|
||||
// (sourceCfg account)
|
||||
// (outgoingCfg account)
|
||||
// (gpgCfg account)
|
||||
builtins.foldl' (acc: f: acc // f account) { } [
|
||||
basicCfg
|
||||
sourceCfg
|
||||
outgoingCfg
|
||||
gpgCfg
|
||||
signatureCfg
|
||||
]
|
||||
// account.aerc.extraAccounts;
|
||||
|
||||
mkAccountConfig = name: account: mapAttrNames (addAccountName name) account.aerc.extraConfig;
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ let
|
|||
accounts = import ./accounts.nix {
|
||||
inherit
|
||||
config
|
||||
pkgs
|
||||
lib
|
||||
confSection
|
||||
confSections
|
||||
;
|
||||
inherit (pkgs) writeText writeShellScript;
|
||||
};
|
||||
|
||||
aerc-accounts = attrsets.filterAttrs (_: v: v.aerc.enable) config.accounts.email.accounts;
|
||||
|
|
|
|||
|
|
@ -91,3 +91,11 @@ from = test <test@email.invalid>
|
|||
outgoing = imap+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337
|
||||
postpone = dRaFts
|
||||
source = smtp+plain://intentionallyWrong:PaSsWorD@smtp.host.invalid:1337
|
||||
|
||||
[q_signature_text]
|
||||
from = Foo Bar <addr@mail.invalid>
|
||||
signature-file = /nix/store/00000000000000000000000000000000-aerc-signature.txt
|
||||
|
||||
[r_signature_command]
|
||||
from = Foo Bar <addr@mail.invalid>
|
||||
signature-cmd = /nix/store/00000000000000000000000000000000-aerc-signature.sh
|
||||
|
|
|
|||
|
|
@ -10,13 +10,18 @@
|
|||
"home-files/.config/aerc";
|
||||
in
|
||||
''
|
||||
assertFileContent ${dir}/accounts.conf ${./extraAccounts.expected}
|
||||
assertFileContent ${dir}/binds.conf ${./extraBinds.expected}
|
||||
assertFileContent ${dir}/aerc.conf ${./extraConfig.expected}
|
||||
assertFileContent ${dir}/templates/bar ${./templates.expected}
|
||||
assertFileContent ${dir}/templates/foo ${./templates.expected}
|
||||
assertFileContent ${dir}/stylesets/default ${./stylesets.expected}
|
||||
assertFileContent ${dir}/stylesets/asLines ${./stylesets.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/accounts.conf) ${./extraAccounts.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/binds.conf) ${./extraBinds.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/aerc.conf) ${./extraConfig.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/templates/bar) ${./templates.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/templates/foo) ${./templates.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/stylesets/default) ${./stylesets.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/stylesets/asLines) ${./stylesets.expected}
|
||||
assertFileContent $(normalizeStorePaths ${dir}/stylesets/asLines) ${./stylesets.expected}
|
||||
|
||||
assertFileContent $(normalizeStorePaths /nix/store/*-aerc-signature.sh) ${./signature-command.expected}
|
||||
assertFileContent $(normalizeStorePaths /nix/store/*-aerc-signature.txt) ${./signature-file.expected}
|
||||
assertFileContent $(normalizeStorePaths /nix/store/*-user-signature.sh) ${./signature-command-script.expected}
|
||||
'';
|
||||
|
||||
programs.aerc = {
|
||||
|
|
@ -291,6 +296,26 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
q_signature_text = basics // {
|
||||
signature = {
|
||||
showSignature = "append";
|
||||
delimiter = "~~~";
|
||||
text = ''
|
||||
some signature
|
||||
goes here
|
||||
'';
|
||||
};
|
||||
};
|
||||
r_signature_command = basics // {
|
||||
signature = {
|
||||
showSignature = "append";
|
||||
delimiter = "~~~";
|
||||
command = pkgs.writeShellScript "user-signature.sh" ''
|
||||
echo "some signature"
|
||||
echo "goes here"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
#!/nix/store/00000000000000000000000000000000-bash/bin/bash
|
||||
echo "some signature"
|
||||
echo "goes here"
|
||||
|
||||
3
tests/modules/programs/aerc/signature-command.expected
Normal file
3
tests/modules/programs/aerc/signature-command.expected
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#!/nix/store/00000000000000000000000000000000-bash/bin/bash
|
||||
printf '%s\n' "~~~"
|
||||
/nix/store/00000000000000000000000000000000-user-signature.sh
|
||||
3
tests/modules/programs/aerc/signature-file.expected
Normal file
3
tests/modules/programs/aerc/signature-file.expected
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
~~~
|
||||
some signature
|
||||
goes here
|
||||
Loading…
Add table
Add a link
Reference in a new issue