Files
nixos/modules/packages/git.nix
2025-09-27 11:05:51 +08:00

25 lines
904 B
Nix

inputs:
{
options.nixos.packages.git = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) git; in inputs.lib.mkIf (git != null)
{
programs.git =
{
enable = true;
# do not use gitFull, otherwise it will use its own ssh
# package = inputs.pkgs.gitFull;
lfs = { enable = true; enablePureSSHTransfer = true; };
config =
{
init.defaultBranch = "main";
core.quotepath = false;
lfs.ssh.automultiplex = false; # 避免 lfs 一直要求触摸 yubikey
receive.denyCurrentBranch = "warn"; # 允许 push 到非 bare 的仓库
merge.ours.driver = true; # 允许 .gitattributes 中设置的 merge=ours 生效
advice.addIgnoredFile = false; # 关闭 add 忽略文件时的提示
};
};
};
}