54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ lib, config, pkgs, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.modules.cli.git;
|
|
in
|
|
{
|
|
options.modules.cli.git = {
|
|
enable = mkEnableOption "enable git";
|
|
|
|
userName = mkOption {
|
|
type = types.str;
|
|
default = "Yorick Barbanneau";
|
|
description = "git username";
|
|
};
|
|
|
|
userEmail = mkOption {
|
|
type = types.str;
|
|
default = "ephase@xieme-art.org";
|
|
description = "git email";
|
|
};
|
|
};
|
|
config = mkIf cfg.enable {
|
|
programs.git = {
|
|
enable = true;
|
|
delta = {
|
|
enable = true;
|
|
options = {
|
|
dark = true;
|
|
line-numbers = true;
|
|
syntax-theme = "base16-256";
|
|
|
|
};
|
|
};
|
|
package = pkgs.gitFull;
|
|
userName = "${cfg.userName}";
|
|
userEmail = "${cfg.userEmail}";
|
|
aliases = {
|
|
fa = "fetch --all";
|
|
far = "!git fa; git rebase";
|
|
l = "log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
|
lg = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
|
pf = "push --force-with-lease";
|
|
rewrite = "!git commit --amend --no-edit && git push --force-with-lease";
|
|
st = "status -sb";
|
|
};
|
|
extraConfig = {
|
|
push = {
|
|
autoSetupRemote = true;
|
|
default = "current";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|