server/programs/jj/default.nix
Jana Dönszelmann 8102d1d009
Some checks failed
/ lint (push) Failing after 39s
new website
2026-05-06 11:22:40 +02:00

222 lines
6.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

inputs@{ machine, ... }:
{
imports = machine.program {
name = "jujutsu";
inherit inputs;
requirements = [ "cli" ];
home-config =
{ config, pkgs, ... }:
{
programs.jujutsu = {
enable = true;
# package = pkgs.custom.jujutsu;
settings = {
user = {
inherit (config.programs.git.settings.user) email;
inherit (config.programs.git.settings.user) name;
};
ui = {
# paginate = "never";
# pager = "${pkgs.delta}/bin/delta";
# for delta
# diff-formatter = ":git";
diff-formatter = [
"${pkgs.difftastic}/bin/difft"
"--color=always"
"$left"
"$right"
];
default-command = [
"log"
];
merge-editor = [
"${pkgs.meld}/bin/meld"
"$left"
"$base"
"$right"
"-o"
"$output"
"--auto-merge"
];
# diff-editor = "${pkgs.meld}/bin/meld";
};
fsmonitor.backend = "watchman";
fsmonitor.watchman.register-snapshot-trigger = true;
revsets.log = "@ | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()";
# revsets.log = "trunk()..@ | @..trunk() | trunk() | @:: | fork_point(trunk() | @)";
# revsets.log = "trunk() | ancestors(trunk()..heads(((trunk()..visible_heads()) & my() | @)::), 2)";
revset-aliases = {
"my()" = "user(\"${config.programs.jujutsu.settings.user.email}\")";
"user(x)" = "author(x) | committer(x)";
current = "bookmarks() & my() & ~immutable()";
"closest_bookmark(to)" = "heads(::to & bookmarks())";
};
template-aliases = {
"format_timestamp(timestamp)" = "timestamp.ago()";
log_oneline = ''
if(root,
format_root_commit(self),
label(if(current_working_copy, "working_copy"),
concat(
separate(" ",
format_short_change_id_with_change_offset(self),
if(empty, label("empty", "(empty)")),
if(description,
description.first_line(),
label(if(empty, "empty"), description_placeholder),
),
bookmarks,
tags,
working_copies,
if(conflict, label("conflict", "conflict")),
if(config("ui.show-cryptographic-signatures").as_boolean(),
format_short_cryptographic_signature(signature)),
) ++ "\n",
),
)
)
'';
# if(.contained_in('first_parent(@)'), label("git_head", "HEAD")),
status_summary = "'\n' ++ self.diff().summary() ++ '\n'";
space = "'\n\n\n'";
log_oneline_with_status_summary = "if(self.current_working_copy(), space) ++ log_oneline ++ if(self.current_working_copy() && self.diff().files().len() > 0, status_summary)";
};
aliases =
let
util = script: [
"util"
"exec"
"--"
"bash"
"-c"
script
];
tug = [
"bookmark"
"move"
"--from"
"heads(@- & bookmarks())"
"--to"
"coalesce(@ & ~empty(), @-)"
];
in
{
inherit tug;
fuck = [
"bookmark"
"move"
"--from"
"heads(@ & bookmarks())"
"--to"
"@-"
"--allow-backwards"
];
catchup = [
"rebase"
"-b"
"bookmarks() & mine() & ~immutable()"
"-d"
"trunk()"
"--skip-emptied"
];
pull = util ''
jj git fetch
jj catchup
'';
ch = [
"show"
"--stat"
];
move = [
"rebase"
"-r"
];
push = [
"git"
"push"
];
ll = [
"log"
"-T"
"builtin_log_compact"
];
mdiff = [
"diff"
"--from"
"trunk()"
];
n = [
"edit"
"@+"
];
p = [
"edit"
"@-"
];
gp = [
"git"
"push"
];
t = tug;
d = [ "describe" ];
dm = [
"describe"
"-m"
];
e = [ "edit" ];
s = [ "squash" ];
si = [ "squash -i" ];
sp = [ "split" ];
};
templates = {
log_node = ''
label("node",
coalesce(
if(!self, label("elided", "~")),
if(current_working_copy, label("working_copy", "@")),
if(conflict, label("conflict", "×")),
if(immutable, label("immutable", "*")),
label("normal", "·")
)
)
'';
log = "log_oneline_with_status_summary";
git_push_bookmark = ''"jdonszelmann/" ++ change_id.short()'';
};
signing = {
# sign-all = true;
behavior = "own";
backend = "ssh";
key = "~/.ssh/id_ed25519.pub";
};
remotes.origin.auto-track-bookmarks = "*";
# remotes.upstream.auto-track-bookmarks = true;
git = {
private-commits = "description(glob:'wip:*') | description(glob:'trial:*')";
write-change-id-header = true;
fetch = [
"upstream"
"origin"
];
push = "origin";
};
};
};
};
};
}