74 lines
1.9 KiB
Nix
74 lines
1.9 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";
|
|
};
|
|
|
|
signingKey = mkOption {
|
|
type = types.str;
|
|
default = null;
|
|
description = "signing key fingerprint";
|
|
};
|
|
|
|
signByDefault = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "activate signing by default";
|
|
};
|
|
};
|
|
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}";
|
|
signing.key = "${cfg.signingKey}";
|
|
signing.signByDefault = cfg.signByDefault;
|
|
aliases = {
|
|
co = "checkout";
|
|
fa = "fetch --all";
|
|
far = "!git fa; git rebase";
|
|
l = "log --pretty=format:'%C(red)%h%C(reset) -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(dim white)<%an>%Creset'";
|
|
la = "l --all";
|
|
lg = "log --graph --abbrev-commit --decorate --format=format:'%C(red)%h%C(reset) ┬ %C(cyan)%aD%C(reset) %C(green)(%ar)%C(reset)%C(yellow)%d%C(reset) %C(dim white) <%an>%C(reset)%n'' └─ %C(white)%s%C(reset)'";
|
|
lga = "lg --all";
|
|
pf = "push --force-with-lease";
|
|
rewrite = "!git commit --amend --no-edit && git push --force-with-lease";
|
|
st = "status -sb";
|
|
};
|
|
extraConfig = {
|
|
core = {
|
|
abbrev = 8;
|
|
};
|
|
push = {
|
|
autoSetupRemote = true;
|
|
default = "current";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|