nix-config/homeManagerModules/programs/git.nix

70 lines
1.5 KiB
Nix

{
lib,
config,
...
}:
let
cfg = config.krop.hm.programs.git;
in
{
options.krop.hm.programs.git = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = "Enable my git configuration";
};
work-config = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Generate my job configuration";
};
};
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
userName = "Jakub Kropáček";
userEmail = "kropikuba@gmail.com";
includes =
if cfg.work-config then
let
workcfg = {
user = {
email = "jakub.kropacek@olc.cz";
name = "Jakub Kropáček";
};
};
in
[
{
condition = "gitdir:~/Repositories/OLC/**";
contents = workcfg;
}
{
condition = "gitdir:~/Repositories/OLC-Hexpol/**";
contents = workcfg;
}
]
else
[ ];
extraConfig = {
init = {
defaultBranch = "master";
};
push = {
autoSetupRemote = true;
};
status = {
submoduleSummary = true;
};
diff = {
submodule = "log";
};
core = {
autocrlf = "input";
};
};
};
};
}