61 lines
1.3 KiB
Nix
61 lines
1.3 KiB
Nix
{ lib, config, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.progs.git;
|
|
in
|
|
{
|
|
options.progs.git = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Add git with my personal settings";
|
|
};
|
|
|
|
userName = mkOption {
|
|
type = types.str;
|
|
description = "Set your global name";
|
|
};
|
|
|
|
userEmail = mkOption {
|
|
type = types.str;
|
|
description = "Set your global email";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
programs.git = {
|
|
enable = true;
|
|
userName = cfg.userName;
|
|
userEmail = cfg.userEmail;
|
|
extraConfig = {
|
|
init.defaultBranch = "main";
|
|
pull.rebase = true;
|
|
};
|
|
aliases = {
|
|
co = "checkout";
|
|
cob = "checkout -b";
|
|
cobf = "checkout -B";
|
|
st = "status -sb";
|
|
d = "diff";
|
|
dc = "diff --cached";
|
|
aa = "add .";
|
|
ai = "add -i";
|
|
c = "commit";
|
|
cm = "commit -m";
|
|
ca = "commit --amend";
|
|
cam = "commit --amend -m";
|
|
can = "commit --amend --no-edit";
|
|
p = "push";
|
|
po = "push origin";
|
|
pf = "push --force-with-lease";
|
|
pfo = "push --force-with-lease origin";
|
|
pl = "pull";
|
|
plo = "pull origin";
|
|
rb = "rebase";
|
|
rbi = "rebase -i";
|
|
};
|
|
};
|
|
};
|
|
}
|