nix/home-manager/shared/programs/shell/git.nix
2025-05-08 02:41:24 -05:00

73 lines
2 KiB
Nix
Executable file

{pkgs, ...}: {
programs.git = {
enable = true;
userEmail = "cjriddz@protonmail.com";
userName = "iofq";
delta = {
enable = true;
options = {
side-by-side = true;
line-numbers = true;
};
};
extraConfig = {
core.editor = "nvim";
};
signing = {
key = "cjriddz@protonmail.com";
signByDefault = false;
};
extraConfig.pull.rebase = true;
};
programs.jujutsu = {
enable = true;
settings = {
user = {
email = "cjriddz@protonmail.com";
name = "iofq";
};
operation = {
username = "iofq";
};
ui = {
default-command = ["log"];
conflict-marker-style = "git";
merge-editor = "vimdiff";
diff-editor = "diffview";
diff.format = "git";
};
merge-tools.vimdiff = {
program = "nvim";
};
merge-tools.diffview = {
program = "sh";
edit-args = [
"-c"
''
set -eu
rm -f "$right/JJ-INSTRUCTIONS"
git -C "$left" init -q
git -C "$left" add -A
git -C "$left" commit -q -m baseline --allow-empty
mv "$left/.git" "$right"
git -C "$right" add --intent-to-add -A
(cd "$right"; nvim -c "lua require('lazy').load({plugins = {'diffview.nvim'}})" -c DiffviewOpen)
git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; }
git -C "$right" commit -q -m split
git -C "$right" restore . # undo changes in modified files
git -C "$right" reset . # undo --intent-to-add
git -C "$right" clean -q -df # remove untracked files
''
];
};
snapshot = {
max-new-file-size = "10MiB";
};
aliases = {
tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@"];
ne = ["next" "--edit"];
be = ["edit" "-r" "@-"];
};
};
};
}