mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
git: generate identities from mail accounts
This commit is contained in:
parent
604fc92943
commit
a68c8cf5f1
1 changed files with 24 additions and 1 deletions
|
@ -63,7 +63,10 @@ in
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.git;
|
default = pkgs.git;
|
||||||
defaultText = "pkgs.git";
|
defaultText = "pkgs.git";
|
||||||
description = "Git package to install.";
|
description = ''
|
||||||
|
Git package to install. Use <varname>pkgs.gitAndTools.gitFull</varname>
|
||||||
|
to gain access to <command>git send-email</command> for instance.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
userName = mkOption {
|
userName = mkOption {
|
||||||
|
@ -142,6 +145,26 @@ in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.git.iniContent =
|
||||||
|
let
|
||||||
|
hasSmtp = name: account: account.smtp != null;
|
||||||
|
|
||||||
|
genIdentity = name: account: with account;
|
||||||
|
nameValuePair "sendemail.${name}" ({
|
||||||
|
smtpEncryption = if smtp.tls.enable then "tls" else "";
|
||||||
|
smtpServer = smtp.host;
|
||||||
|
smtpUser = userName;
|
||||||
|
from = address;
|
||||||
|
}
|
||||||
|
// optionalAttrs (smtp.port != null) {
|
||||||
|
smtpServerPort = smtp.port;
|
||||||
|
});
|
||||||
|
in
|
||||||
|
mapAttrs' genIdentity
|
||||||
|
(filterAttrs hasSmtp config.accounts.email.accounts);
|
||||||
|
}
|
||||||
|
|
||||||
(mkIf (cfg.signing != null) {
|
(mkIf (cfg.signing != null) {
|
||||||
programs.git.iniContent = {
|
programs.git.iniContent = {
|
||||||
user.signingKey = cfg.signing.key;
|
user.signingKey = cfg.signing.key;
|
||||||
|
|
Loading…
Reference in a new issue