nichts/modules/programs/cli/jj.mod.nix
Bloxx12 e641dfa114
treewide: format using nixfmt
Signed-off-by: Bloxx12 <charlie@charlieroot.dev>
Change-Id: I6a6a69641c36f9763e104087a559c148d0449f00
2025-07-20 02:14:32 +02:00

139 lines
2.7 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (lib.meta) getExe;
toml = pkgs.formats.toml { };
jj-config = toml.generate "config.toml" {
user = {
name = "Bloxx12";
email = "charlie@charlieroot.dev";
};
ui = {
pager = [
"${getExe pkgs.bat}"
"--plain"
];
default-command = "log";
movement.edit = true;
diff.tool = [
"${getExe pkgs.difftastic}"
"--color"
"always"
"$left"
"$right"
];
};
# FIXME: do this with agenix
# "--scope" = [
# {
# "--when.repositories" = ["~/repos/projects/uni"];
# user = {
# # TODO
# name = "";
# email = "";
# };
# }
# {
# "--when.repositories" = ["~/repos/projects/uni/"];
# user = {
# # TODO
# name = "";
# email = "";
# };
# }
# ];
git.push-new-bookmarks = true;
signing = {
behaviour = "own";
backend = "ssh";
key = [
"ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw=="
];
};
aliases = {
c = [ "commit" ];
ci = [
"commit"
"--interactive"
];
e = [ "edit" ];
# "new bookmark"
nb = [
"bookmark"
"create"
"-r @-"
];
pull = [
"git"
"fetch"
];
push = [
"git"
"push"
"--allow-new"
];
r = [ "rebase" ];
s = [ "squash" ];
si = [
"squash"
"--interactive"
];
tug = [
"bookmark"
"move"
"--from"
"closest_bookmark(@-)"
"--to"
"@-"
];
};
revset-aliases = {
"closest_bookmark(to)" = "heads(::to & bookmarks())";
};
templates = {
draft_commit_description = ''
concat(
coalesce(description, "\n"),
surround(
"\nJJ: This commit contains the following changes:\n", "",
indent("JJ: ", diff.stat(72)),
),
"\nJJ: ignore-rest\n",
diff.git(),
)
'';
};
template-aliases = {
"format_short_id(id)" = "id.shortest()";
};
};
jj-wrapped = pkgs.symlinkJoin {
name = "jj-wrapped";
paths = [ pkgs.jj ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/mako --add-flags "\
--config ${jj-config}
'';
};
in
{
# environment.systemPackages = [jj-wrapped];
}