nixos-config/users/simon/modules/git.nix

84 lines
2.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ config, pkgs, ... }:
{
programs.git = {
enable = true;
userName = "Simon Bruder";
userEmail = "simon@sbruder.de";
signing = {
key = config.programs.gpg.settings.default-key;
signByDefault = true;
};
extraConfig = {
core.quotepath = "off";
pull.ff = "only";
diff = {
age = {
# This uses the de facto default key location with no ability to
# specify another key.
# If decryption fails (e.g. due to a lack of the right private key,
# rages error message will be displayed instead of the files
# contents.
textconv = toString (pkgs.writeShellScript "git-age-textconv" ''
${pkgs.rage}/bin/rage -d -i ${config.xdg.configHome}/age/keys.txt "$@" 2>&1 || true
'');
};
sops.textconv = "${pkgs.sops}/bin/sops -d";
};
};
ignores = [
"*.swp"
".direnv"
"Session.vim"
];
lfs.enable = true;
delta = {
enable = true;
options = {
line-numbers = "true";
side-by-side = "true";
features = "decorations";
syntax-theme = "base16";
decorations = {
commit-decoration-style = "bold yellow box ul";
file-style = "bold yellow ul";
file-decoration-style = "none";
};
};
};
aliases = {
ls = "log --stat";
};
};
programs.zsh.shellAliases = {
ga = "git add";
gap = "git add --patch";
gc = "git commit";
gco = "git checkout";
gcp = "git cherry-pick";
gcv = "git commit --verbose";
gd = "git diff";
gdc = "git diff --cached";
gfom = "git fetch origin master";
gl = "git log";
glp = "git log --patch";
gls = "git log --stat";
gp = "git push";
grb = "git rebase";
grbi = "git rebase -i";
grbim = "git rebase -i master";
grbm = "git rebase master";
grbom = "git rebase origin/master";
grs = "git restore";
grss = "git restore --staged";
gs = "git switch";
gsc = "git switch -c";
gsm = "git switch master";
gst = "git status";
};
}