fix(git): degrade gracefully without 'nvim'

This commit is contained in:
2026-10-11 17:34:29 +02:00
parent fbd34508c5
commit 14c6a27b21
+82 -85
View File
@@ -70,100 +70,97 @@ in
}; };
} }
// { // {
assertions = [ warnings = lib.optional (
{ !config.nvim.enable
assertion = config.nvim.enable; ) "'git.enable' is enabled without 'nvim.enable' (not using 'nvimdiff')";
message = "git module requires 'nvim' module (`nvimdiff`)";
}
];
xdg.configFile."git/ignore".source = ./global.gitignore; xdg.configFile."git/ignore".source = ./global.gitignore;
programs.git = { programs.git = {
enable = true; enable = true;
settings = { settings = lib.mkMerge [
core.editor = "nvim"; {
user = { user = {
name = "Hektor Misplon"; name = "Hektor Misplon";
username = "hektor"; username = "hektor";
signingKey = "AEB98353B8D72E465C4236435151AF79E723F21C"; signingKey = "AEB98353B8D72E465C4236435151AF79E723F21C";
};
alias = {
d = "diff";
ds = "diff --staged";
a = "add";
ap = "add -p";
c = "commit";
cm = "commit -m";
cam = "commit --amend";
l = ''log --pretty=format:(%an)\ \ %h\ \ %ad\ \ %s --date=short'';
s = "status --short";
sv = "status --verbose";
co = "checkout";
cob = "checkout -b";
pullr = "pull --rebase --autostash";
pushf = "push --force-with-lease";
al = "!git config -l | grep alias | cut -c 7-";
alf = "!git config -l | grep alias | cut -c 7- | fzf";
"al-" =
''!git config --local --unset $(git config -l | grep alias | cut --delimiter="=" --fields=1 | fzf)'';
rs = "restore --staged";
rb = "rebase";
rbi = "rebase -i";
wt = "worktree";
wtc = ''config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"'';
};
color = {
ui = "auto";
diff = {
meta = "yellow bold";
commit = "green bold";
frag = "magenta bold";
old = "red bold";
new = "green bold";
whitespace = "red reverse";
}; };
"diff-highlight" = { alias = {
oldNormal = "red bold"; d = "diff";
oldHighlight = "red bold 52"; ds = "diff --staged";
newNormal = "green bold"; a = "add";
newHighlight = "green bold 22"; ap = "add -p";
c = "commit";
cm = "commit -m";
cam = "commit --amend";
l = ''log --pretty=format:(%an)\ \ %h\ \ %ad\ \ %s --date=short'';
s = "status --short";
sv = "status --verbose";
co = "checkout";
cob = "checkout -b";
pullr = "pull --rebase --autostash";
pushf = "push --force-with-lease";
al = "!git config -l | grep alias | cut -c 7-";
alf = "!git config -l | grep alias | cut -c 7- | fzf";
"al-" =
''!git config --local --unset $(git config -l | grep alias | cut --delimiter="=" --fields=1 | fzf)'';
rs = "restore --staged";
rb = "rebase";
rbi = "rebase -i";
wt = "worktree";
wtc = ''config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"'';
}; };
branch = { color = {
current = "normal bold"; ui = "auto";
local = "normal"; diff = {
remote = "normal italic"; meta = "yellow bold";
commit = "green bold";
frag = "magenta bold";
old = "red bold";
new = "green bold";
whitespace = "red reverse";
};
"diff-highlight" = {
oldNormal = "red bold";
oldHighlight = "red bold 52";
newNormal = "green bold";
newHighlight = "green bold 22";
};
branch = {
current = "normal bold";
local = "normal";
remote = "normal italic";
};
status = {
added = "green";
changed = "yellow";
untracked = "normal italic";
};
}; };
status = { credential.helper = "cache --timeout=3600";
added = "green"; init.defaultBranch = "main";
changed = "yellow"; log = {
untracked = "normal italic"; date = "relative";
abbrevCommit = true;
}; };
}; merge.conflictStyle = "diff3";
credential.helper = "cache --timeout=3600"; diff.colorMoved = "zebra";
init.defaultBranch = "main"; commit.gpgSign = false;
log = { interactive.singleKey = true;
date = "relative"; pull.rebase = true;
abbrevCommit = true; rerere.enabled = true;
}; }
merge = { (lib.mkIf config.nvim.enable {
tool = "nvimdiff"; core.editor = "nvim";
conflictStyle = "diff3"; diff.tool = "nvimdiff";
}; merge.tool = "nvimdiff";
diff = { difftool.prompt = false;
colorMoved = "zebra"; mergetool = {
tool = "nvimdiff"; prompt = false;
}; keepBackup = false;
difftool.prompt = false; };
mergetool = { })
prompt = false; ];
keepBackup = false;
};
commit.gpgSign = false;
interactive.singleKey = true;
pull.rebase = true;
rerere.enabled = true;
};
includes = [ includes = [
{ path = personalEmail; } { path = personalEmail; }