blob: 62411a6b89854dde2bfd08dcfb2f4e159231e2d1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
lib,
pkgs,
config,
...
}: let
cfg = config.soispha.programs.git;
gitIgnoreFile = ./git_ignore.git;
gitTemplateFile = ./git_template.git;
in {
options.soispha.programs.git = {
enable = lib.mkEnableOption "an opinionated git config";
defaultBranchName = lib.mkOption {
type = lib.types.str;
description = "The name of the default branch.";
default = "prime";
};
};
config = lib.mkIf cfg.enable {
home-manager.users.soispha = {
programs.delta = {
enable = true;
enableGitIntegration = true;
options = {
decorations = {
commit-decoration-style = "bold yellow box ul";
file-decoration-style = "none";
file-style = "bold yellow ul";
};
keep-plus-minus-markers = true;
features = "decorations";
whitespace-error-style = "22 reverse";
};
};
# Add my custom git-scripts
home.packages = [
pkgs.git-cgit # Allows fast cgit settings setup
];
programs.git = {
enable = true;
signing.format = "openpgp";
settings = {
alias = import ./aliases.nix {
inherit lib;
inherit (cfg) defaultBranchName;
};
core = {
excludesFile = "${gitIgnoreFile}";
};
rebase = {
autoStash = true;
autoSquash = true;
};
init = {
defaultBranch = cfg.defaultBranchName;
};
user = {
name = "Benedikt Peetz";
email = "benedikt.peetz@b-peetz.de";
# signingKey = "[is down below]";
};
help = {
autocorrect = 5;
};
push = {
gpgSign = "if-asked";
};
commit = {
template = "${gitTemplateFile}";
};
diff = {
colorMoved = "default";
# Usually leads to better results
algorithm = "patience";
bin = {
textconv = "hexdump -v -C";
};
};
# Makes it a bit more readable
blame = {
coloring = "repeatedLines";
markIgnoredLines = true;
markUnblamables = true;
};
merge = {
conflictstyle = "zdiff3";
};
url = {
"git@codeberg.org:" = {
insteadOf = "@cb:";
};
"https://codeberg.org/" = {
insteadOf = "cb://";
};
"git@github.com:" = {
insteadOf = "@gh:";
};
"https://github.com/" = {
insteadOf = "gh://";
};
"git@gitlab.com:" = {
insteadOf = "@gl:";
};
"https://gitlab.com/" = {
insteadOf = "gl://";
};
};
};
signing = {
key = "8321ED3A8DB999A51F3BF80FF2682914EA42DE26";
signByDefault = true;
};
};
};
};
}
|