diff --git a/modules/programs/git.nix b/modules/programs/git.nix
index e8018dc1..9b7858bf 100644
--- a/modules/programs/git.nix
+++ b/modules/programs/git.nix
@@ -63,7 +63,10 @@ in
type = types.package;
default = pkgs.git;
defaultText = "pkgs.git";
- description = "Git package to install.";
+ description = ''
+ Git package to install. Use pkgs.gitAndTools.gitFull
+ to gain access to git send-email for instance.
+ '';
};
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) {
programs.git.iniContent = {
user.signingKey = cfg.signing.key;