2024-01-06 01:19:35 +01:00
|
|
|
|
# SPDX-FileCopyrightText: 2018-2023 Simon Bruder <simon@sbruder.de>
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
2022-06-16 19:25:11 +02:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
2020-11-07 15:40:07 +01:00
|
|
|
|
{
|
|
|
|
|
programs.git = {
|
|
|
|
|
enable = true;
|
2022-06-16 19:25:11 +02:00
|
|
|
|
package = pkgs.gitFull;
|
2020-11-07 15:40:07 +01:00
|
|
|
|
userName = "Simon Bruder";
|
|
|
|
|
userEmail = "simon@sbruder.de";
|
|
|
|
|
signing = {
|
2020-12-24 23:08:05 +01:00
|
|
|
|
key = config.programs.gpg.settings.default-key;
|
2020-11-07 15:40:07 +01:00
|
|
|
|
signByDefault = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extraConfig = {
|
2023-04-18 15:55:03 +02:00
|
|
|
|
# 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'');
|
2020-11-07 15:40:07 +01:00
|
|
|
|
core.quotepath = "off";
|
|
|
|
|
pull.ff = "only";
|
2023-10-25 21:18:56 +02:00
|
|
|
|
merge = {
|
|
|
|
|
ff = "only";
|
|
|
|
|
};
|
2021-02-08 19:19:18 +01:00
|
|
|
|
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,
|
|
|
|
|
# rage’s error message will be displayed instead of the file’s
|
|
|
|
|
# contents.
|
|
|
|
|
textconv = toString (pkgs.writeShellScript "git-age-textconv" ''
|
|
|
|
|
${pkgs.rage}/bin/rage -d -i ${config.xdg.configHome}/age/keys.txt "$@" 2>&1 || true
|
|
|
|
|
'');
|
|
|
|
|
};
|
2021-04-06 11:36:08 +02:00
|
|
|
|
sops.textconv = "${pkgs.sops}/bin/sops -d";
|
2021-02-08 19:19:18 +01:00
|
|
|
|
};
|
2022-06-16 19:25:11 +02:00
|
|
|
|
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 $@";
|
|
|
|
|
};
|
2020-11-07 15:40:07 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ignores = [
|
|
|
|
|
"*.swp"
|
2023-04-24 15:40:05 +02:00
|
|
|
|
".ccls-cache"
|
2020-11-07 15:40:07 +01:00
|
|
|
|
".direnv"
|
|
|
|
|
"Session.vim"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
lfs.enable = true;
|
|
|
|
|
delta = {
|
|
|
|
|
enable = true;
|
|
|
|
|
options = {
|
|
|
|
|
line-numbers = "true";
|
|
|
|
|
side-by-side = "true";
|
|
|
|
|
features = "decorations";
|
|
|
|
|
syntax-theme = "base16";
|
2023-04-24 15:47:58 +02:00
|
|
|
|
blame-code-style = "syntax";
|
2020-11-07 15:40:07 +01:00
|
|
|
|
decorations = {
|
|
|
|
|
commit-decoration-style = "bold yellow box ul";
|
|
|
|
|
file-style = "bold yellow ul";
|
|
|
|
|
file-decoration-style = "none";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2021-03-19 18:12:15 +01:00
|
|
|
|
|
|
|
|
|
aliases = {
|
|
|
|
|
ls = "log --stat";
|
|
|
|
|
};
|
2023-04-07 23:28:16 +02:00
|
|
|
|
|
|
|
|
|
includes = map
|
|
|
|
|
(condition: {
|
|
|
|
|
inherit condition;
|
|
|
|
|
contents = {
|
2023-04-30 19:13:31 +02:00
|
|
|
|
user.email = "simon.bruder@mailbox.tu-dresden.de";
|
2023-04-07 23:28:16 +02:00
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
[
|
|
|
|
|
"gitdir:~/Documents/uni/"
|
|
|
|
|
"gitdir:~/projects/uni/"
|
|
|
|
|
];
|
2021-03-19 18:12:15 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-09-06 16:30:14 +02:00
|
|
|
|
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";
|
2023-10-25 21:16:12 +02:00
|
|
|
|
gcam = "git commit --amend";
|
2021-09-06 16:30:14 +02:00
|
|
|
|
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";
|
2023-10-25 21:16:12 +02:00
|
|
|
|
grbc = "git rebase --continue";
|
2021-09-06 16:30:14 +02:00
|
|
|
|
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";
|
|
|
|
|
};
|
2022-06-16 19:25:11 +02:00
|
|
|
|
|
|
|
|
|
xdg.configFile = {
|
|
|
|
|
"pass-git-helper/git-pass-mapping.ini".text = lib.generators.toINI { } {
|
|
|
|
|
"vueko.sbruder.de:587".target = "sbruder.de/mail";
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-02-22 00:05:01 +01:00
|
|
|
|
|
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
|
gitAndTools.pre-commit # pre-commit hook helper
|
|
|
|
|
];
|
2020-11-07 15:40:07 +01:00
|
|
|
|
}
|