my jj config
jj.nix
154 lines 5.0 kB view raw
1{ config 2, pkgs 3, theme 4, ... 5}: 6 7with theme; 8{ 9 programs.jujutsu = { 10 enable = true; 11 settings = { 12 user = { 13 name = "oppiliappan"; 14 email = "me@oppi.li"; 15 }; 16 ui = { 17 # paginate = "never"; 18 default-command = "status"; 19 pager = "${pkgs.delta}/bin/delta"; 20 diff-formatter = ":git"; 21 graph.style = "curved"; 22 should-sign-off = true; 23 }; 24 colors = { 25 commit_id = "magenta"; 26 change_id = "cyan"; 27 "working_copy empty" = "green"; 28 "working_copy placeholder" = "red"; 29 "working_copy description placeholder" = "yellow"; 30 "working_copy empty description placeholder" = "green"; 31 prefix = { 32 bold = true; 33 fg = "cyan"; 34 }; 35 rest = { 36 bold = false; 37 fg = "bright black"; 38 }; 39 "node elided" = "yellow"; 40 "node working_copy" = "green"; 41 "node conflict" = "red"; 42 "node immutable" = "red"; 43 "node normal" = { bold = false; }; 44 "node" = { bold = false; }; 45 }; 46 git = { 47 write-change-id-header = true; 48 subprocess = true; 49 }; 50 signing = { 51 behavior = "own"; 52 backend = "ssh"; 53 key = "~/.ssh/oppili_tangled_key.pub"; 54 }; 55 aliases = { 56 d = ["diff"]; 57 l = ["log"]; 58 ll = ["log" "-r" ".."]; 59 tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"]; 60 }; 61 revsets = { 62 log = "current_work"; 63 }; 64 revset-aliases = { 65 "stack()" = "ancestors(reachable(@, mutable()), 2)"; 66 "stack(x)" = "ancestors(reachable(x, mutable()), 2)"; 67 "stack(x, n)" = "ancestors(reachable(x, mutable()), n)"; 68 "current_work" = "trunk()..@ | @..trunk() | trunk() | @:: | fork_point(trunk() | @)"; 69 }; 70 template-aliases = { 71 "format_short_id(id)" = "id.shortest()"; 72 "abbreviate_timestamp_suffix(s, suffix, abbr)" = '' 73 if( 74 s.ends_with(suffix), 75 s.remove_suffix(suffix) ++ label("timestamp", abbr) 76 ) 77 ''; 78 "abbreviate_relative_timestamp(s)" = '' 79 coalesce( 80 abbreviate_timestamp_suffix(s, " millisecond", "ms"), 81 abbreviate_timestamp_suffix(s, " second", "s"), 82 abbreviate_timestamp_suffix(s, " minute", "m"), 83 abbreviate_timestamp_suffix(s, " hour", "h"), 84 abbreviate_timestamp_suffix(s, " day", "d"), 85 abbreviate_timestamp_suffix(s, " week", "w"), 86 abbreviate_timestamp_suffix(s, " month", "mo"), 87 abbreviate_timestamp_suffix(s, " year", "y"), 88 s 89 ) 90 ''; 91 "format_timestamp(timestamp)" = '' 92 coalesce( 93 if(timestamp.after("1 minute ago"), label("timestamp", "<1m")), 94 abbreviate_relative_timestamp(timestamp.ago().remove_suffix(' ago').remove_suffix('s')) 95 ) 96 ''; 97 }; 98 templates = { 99 log = '' 100 if(root, 101 format_root_commit(self), 102 label(if(current_working_copy, "working_copy"), 103 separate(" ", 104 format_short_change_id_with_hidden_and_divergent_info(self), 105 if(empty, label("empty", "(empty)")), 106 if(description, 107 description.first_line(), 108 label(if(empty, "empty"), description_placeholder), 109 ), 110 bookmarks, 111 tags, 112 working_copies, 113 if(git_head, label("git_head", "HEAD")), 114 if(conflict, label("conflict", "conflict")), 115 if(config("ui.show-cryptographic-signatures").as_boolean(), 116 format_short_cryptographic_signature(signature)), 117 format_timestamp(commit_timestamp(self)), 118 ) ++ "\n", 119 ) 120 ) 121 ''; 122 log_node = '' 123 label("node", 124 coalesce( 125 if(!self, label("elided", "~")), 126 if(current_working_copy, label("working_copy", "@")), 127 if(conflict, label("conflict", "×")), 128 if(immutable, label("immutable", "")), 129 label("normal", "·") 130 ) 131 ) 132 ''; 133 draft_commit_description = '' 134 concat( 135 coalesce(description, default_commit_description, "\n"), 136 if( 137 config("ui.should-sign-off").as_boolean() && !description.contains("Signed-off-by: " ++ author.name()), 138 "\nSigned-off-by: " ++ author.name() ++ " <" ++ author.email() ++ ">", 139 ), 140 surround( 141 "\nJJ: This commit contains the following changes:\n", "", 142 indent("JJ: ", diff.stat(72)), 143 ), 144 "\nJJ: ignore-rest\n", 145 diff.git(), 146 ) 147 ''; 148 git_push_bookmark = ''"op/" ++ change_id.short()''; 149 }; 150 }; 151 }; 152} 153 154