37 lines
851 B
Nix
37 lines
851 B
Nix
{ user ? throw "user argument is required" }: { config, pkgs, ... }:
|
|
|
|
let
|
|
hmConfig = config.home-manager.users."${user.name}";
|
|
in
|
|
{
|
|
home-manager.users."${user.name}" = {
|
|
programs.git = {
|
|
enable = true;
|
|
lfs.enable = true;
|
|
userName = user.fullName;
|
|
userEmail = user.email;
|
|
|
|
signing = {
|
|
signByDefault = true;
|
|
key = null;
|
|
};
|
|
|
|
extraConfig = {
|
|
credential.helper = "store";
|
|
push.autoSetupRemote = true;
|
|
};
|
|
|
|
hooks = {
|
|
commit-msg = let name = "git-commit-msg-hook"; in
|
|
"${pkgs.writeShellApplication {
|
|
inherit name;
|
|
runtimeInputs = with pkgs; [ git ];
|
|
text = builtins.readFile ./commit-msg.sh;
|
|
}}/bin/${name}";
|
|
};
|
|
};
|
|
|
|
sops.secrets."git".path = "${hmConfig.xdg.configHome}/git/credentials";
|
|
};
|
|
}
|