1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-03 00:19:46 +01:00
home-manager/tests/modules/programs/git-with-email.nix
Robert Helgesson dff5f07952
tests: reduce number of downloads
This replaces some derivation outputs by simple strings rather than
full Nix store paths. This removes the need to download the whole
derivation when all we need is a static string.

(cherry picked from commit 797c77a00a)
2019-10-29 23:11:09 +01:00

34 lines
884 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";
};
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"
'';
};
}