Skip to content

Commit

Permalink
users: jj templates
Browse files Browse the repository at this point in the history
  • Loading branch information
moni-dz committed Jan 25, 2025
1 parent 2935514 commit 3ab94f0
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions modules/shared/home-manager/vcs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
config,
lib,
pkgs,
self',
...
}:

{
home.packages = __attrValues {
inherit (pkgs.gitAndTools) gh;
inherit (pkgs) gnupg;
};

programs = {
Expand Down Expand Up @@ -41,6 +43,7 @@

jujutsu = {
inherit (config.programs.git) enable;
package = self'.packages.jujutsu;

settings = {
core.fsmonitor = "watchman";
Expand Down Expand Up @@ -127,8 +130,74 @@
];
};

templates = {
log = ''
if(root,
separate(" ",
format_short_change_id(self.change_id()),
format_short_commit_id(self.commit_id()),
label("root", "root()"),
self.bookmarks(),
) ++ "\n",
label(if(current_working_copy, "working_copy"),
concat(
separate(" ",
if(self.conflict(), label("conflict", "conflict")),
if(!empty, label("empty", "∆")),
if(empty && description, label("empty", "merge")),
format_short_change_id_with_hidden_and_divergent_info(self),
format_short_commit_id(self.commit_id()),
self.bookmarks(),
self.tags(),
if(author.name() && author.email(), separate(" as ", author.email().local(), author.name())),
if(author.name() && !author.email(), author.name()),
if(!author.name() && author.email(), author.email().local()),
if(!author.name() && !author.email(), email_placeholder),
commit_timestamp(self).local().format("%Y-%m-%d"),
self.working_copies(),
if(self.git_head(), label("git_head", "git_head()")),
if(config("ui.show-cryptographic-signatures").as_boolean(),
format_short_cryptographic_signature(self.signature())),
)
++ "\n",
if(description, description.first_line() ++ "\n"),
),
)
) ++ "\n"
'';

log_node = ''
coalesce(
if(!self, label("elided", "…")),
label(
separate(" ",
if(current_working_copy, "working_copy"),
if(immutable, "immutable"),
if(conflict, "conflict"),
),
coalesce(
if(current_working_copy, "►"),
if(root, "⌂"),
if(immutable, "■"),
if(conflict, "×"),
"□",
)
)
)
'';

op_log_node = ''
coalesce(
if(current_operation, label("current_operation", "►")),
"□",
)
'';
};

ui = {
editor = "nvim";
graph.style = "square";
show-cryptographic-signatures = false;

default-command = [
"log"
Expand Down

0 comments on commit 3ab94f0

Please sign in to comment.