home-manager/tests/modules/programs/git/git-with-email.nix
Andrew Fontaine baea46c5ac
git: set SSL if useStartTls is false
The git-send-email [0] script uses StartTLS if `smtpEncryption` is set
to `tls`, which can break services that don't support StartTLS.

[0]: bd42bbe1a4/git-send-email.perl (L1533)

PR #1395
2020-08-13 21:36:31 +02:00

39 lines
937 B
Nix

{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
programs.git = {
enable = true;
package = pkgs.gitMinimal;
userEmail = "hm@example.com";
userName = "H. M. Test";
};
home.stateVersion = "20.09";
nmt.script = ''
function assertGitConfig() {
local value
value=$(${pkgs.git}/bin/git config \
--file $TESTED/home-files/.config/git/config \
--get $1)
if [[ $value != $2 ]]; then
fail "Expected option '$1' to have value '$2' but it was '$value'"
fi
}
assertFileExists home-files/.config/git/config
assertFileContent home-files/.config/git/config ${
./git-with-email-expected.conf
}
assertGitConfig "sendemail.hm@example.com.from" "hm@example.com"
assertGitConfig "sendemail.hm-account.from" "hm@example.org"
'';
};
}