nixos-config/users/simon/modules/git.nix
Simon Bruder fc0b5902b9
mail: Temporarily switch to Thunderbird
After much struggle with all clients known to me, I now use Thunderbird.
I might not keep using it for a longer time, so I kept the old
configuration and disabled it, so it can be reused at a later time.

Because Thunderbird doesn’t support nice declarative configuration, I
don’t see much sense in configuring the accounts declaratively, when the
settings for the accounts (which is much more) have to be configured
manually.
2023-05-03 12:31:13 +02:00

129 lines
3.5 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, lib, pkgs, ... }:
{
programs.git = {
enable = true;
package = pkgs.gitFull;
userName = "Simon Bruder";
userEmail = "simon@sbruder.de";
signing = {
key = config.programs.gpg.settings.default-key;
signByDefault = true;
};
extraConfig = {
# Make LTeX not check anything below this.
# I often use git commit -v, which adds a full diff that should not be checked.
commit.template = toString (pkgs.writeText "git-commit-template" ''
# LTeX: enabled=false'');
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";
};
sendemail = {
confirm = "auto";
smtpserver = "vueko.sbruder.de";
smtpuser = "simon@sbruder.de";
smtpencryption = "tls";
smtpserverport = 587;
};
credential = {
helper = "!${pkgs.pass-git-helper}/bin/pass-git-helper $@";
};
};
ignores = [
"*.swp"
".ccls-cache"
".direnv"
"Session.vim"
];
lfs.enable = true;
delta = {
enable = true;
options = {
line-numbers = "true";
side-by-side = "true";
features = "decorations";
syntax-theme = "base16";
blame-code-style = "syntax";
decorations = {
commit-decoration-style = "bold yellow box ul";
file-style = "bold yellow ul";
file-decoration-style = "none";
};
};
};
aliases = {
ls = "log --stat";
};
includes = map
(condition: {
inherit condition;
contents = {
user.email = "simon.bruder@mailbox.tu-dresden.de";
};
})
[
"gitdir:~/Documents/uni/"
"gitdir:~/projects/uni/"
];
};
programs.zsh.shellAliases =
let
defaultBranch = "\${\${\$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null)##refs/remotes/origin/}:-master}";
in
{
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 ${defaultBranch}";
gl = "git log";
glp = "git log --patch";
gls = "git log --stat";
gp = "git push";
grb = "git rebase";
grbi = "git rebase -i";
grbias = "git rebase -i --autosquash";
grbim = "git rebase -i ${defaultBranch}";
grbm = "git rebase ${defaultBranch}";
grbom = "git rebase origin/${defaultBranch}";
grs = "git restore";
grss = "git restore --staged";
gs = "git switch";
gsc = "git switch -c";
gsm = "git switch ${defaultBranch}";
gst = "git status";
};
xdg.configFile = {
"pass-git-helper/git-pass-mapping.ini".text = lib.generators.toINI { } {
"vueko.sbruder.de:587".target = "sbruder.de/mail";
};
};
home.packages = with pkgs; [
gitAndTools.pre-commit # pre-commit hook helper
];
}