2021-02-28 16:06:11 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ ../../accounts/email-test-accounts.nix ];
|
|
|
|
|
|
|
|
config = {
|
|
|
|
accounts.email.accounts."hm@example.com".msmtp.enable = true;
|
2024-05-06 08:17:53 +02:00
|
|
|
|
2021-02-28 16:06:11 +01:00
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.gitMinimal;
|
|
|
|
userEmail = "hm@example.com";
|
|
|
|
userName = "H. M. Test";
|
|
|
|
};
|
|
|
|
|
|
|
|
home.stateVersion = "20.09";
|
|
|
|
|
2021-10-30 20:35:50 +02:00
|
|
|
test.stubs.msmtp = { };
|
|
|
|
|
2021-02-28 16:06:11 +01:00
|
|
|
nmt.script = ''
|
|
|
|
function assertGitConfig() {
|
|
|
|
local value
|
|
|
|
value=$(${pkgs.gitMinimal}/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 \
|
2021-10-30 20:35:50 +02:00
|
|
|
${./git-with-msmtp-expected.conf}
|
2021-02-28 16:06:11 +01:00
|
|
|
|
2024-05-06 08:17:53 +02:00
|
|
|
assertGitConfig "sendemail.hm@example.com.from" "H. M. Test <hm@example.com>"
|
|
|
|
assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. <hm@example.org>"
|
2021-02-28 16:06:11 +01:00
|
|
|
assertGitConfig "sendemail.hm@example.com.smtpServer" "${pkgs.msmtp}/bin/msmtp"
|
2021-02-28 20:42:44 +01:00
|
|
|
assertGitConfig "sendemail.hm@example.com.envelopeSender" "auto"
|
2021-02-28 16:06:11 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|