jj: init
This commit is contained in:
parent
1675c5f193
commit
bd98c92daf
1 changed files with 102 additions and 0 deletions
102
modules/programs/cli/jj/module.nix
Normal file
102
modules/programs/cli/jj/module.nix
Normal file
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
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.difft}" "--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];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue