feat(jujutsu): add jj-cz options to jujutsu module

This commit is contained in:
2026-03-14 14:21:13 +01:00
parent bfaaee0f36
commit 647432314d
4 changed files with 518 additions and 73 deletions

431
flake.lock generated
View File

@@ -1,5 +1,29 @@
{ {
"nodes": { "nodes": {
"alejandra": {
"inputs": {
"fenix": "fenix",
"flakeCompat": "flakeCompat",
"nixpkgs": [
"jj-cz",
"nixpkgs"
]
},
"locked": {
"lastModified": 1744324181,
"narHash": "sha256-Oi1n2ncF4/AWeY6X55o2FddIRICokbciqFYK64XorYk=",
"owner": "kamadorueda",
"repo": "alejandra",
"rev": "3e2a85506627062313e131bf8a85315f3387c8e0",
"type": "github"
},
"original": {
"owner": "kamadorueda",
"ref": "4.0.0",
"repo": "alejandra",
"type": "github"
}
},
"cachix": { "cachix": {
"inputs": { "inputs": {
"devenv": [ "devenv": [
@@ -33,6 +57,43 @@
"type": "github" "type": "github"
} }
}, },
"cachix_2": {
"inputs": {
"devenv": [
"jj-cz",
"devenv"
],
"flake-compat": [
"jj-cz",
"devenv",
"flake-compat"
],
"git-hooks": [
"jj-cz",
"devenv",
"git-hooks"
],
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760971495,
"narHash": "sha256-IwnNtbNVrlZIHh7h4Wz6VP0Furxg9Hh0ycighvL5cZc=",
"owner": "cachix",
"repo": "cachix",
"rev": "c5bfd933d1033672f51a863c47303fc0e093c2d2",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "latest",
"repo": "cachix",
"type": "github"
}
},
"caelestia-cli": { "caelestia-cli": {
"inputs": { "inputs": {
"caelestia-shell": [ "caelestia-shell": [
@@ -126,6 +187,56 @@
"type": "github" "type": "github"
} }
}, },
"devenv_2": {
"inputs": {
"cachix": "cachix_2",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks_2",
"nix": "nix_2",
"nixd": "nixd_2",
"nixpkgs": [
"jj-cz",
"nixpkgs"
]
},
"locked": {
"lastModified": 1770304289,
"narHash": "sha256-+g+XMyB1zi50h2N38GE32l7ZONX4oW7Nw6QSXzfNiwk=",
"owner": "cachix",
"repo": "devenv",
"rev": "fd777e39027d393346e4df672d51ad2bf44b2a12",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"jj-cz",
"alejandra",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1730615655,
"narHash": "sha256-2HBR3zLn57LXKNRtxBb+O+uDqHM4n0pz51rPayMl4cg=",
"owner": "nix-community",
"repo": "fenix",
"rev": "efeb50e2535b17ffd4a135e6e3e5fd60a525180c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -142,6 +253,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1761588595,
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@@ -163,6 +290,28 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"jj-cz",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760948891,
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-root": { "flake-root": {
"locked": { "locked": {
"lastModified": 1723604017, "lastModified": 1723604017,
@@ -178,6 +327,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-root_2": {
"locked": {
"lastModified": 1723604017,
"narHash": "sha256-rBtQ8gg+Dn4Sx/s+pvjdq3CB2wQNzx9XGFq/JVGCB6k=",
"owner": "srid",
"repo": "flake-root",
"rev": "b759a56851e10cb13f6b8e5698af7b59c44be26e",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1678901627, "lastModified": 1678901627,
@@ -211,6 +375,40 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakeCompat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@@ -237,6 +435,34 @@
"type": "github" "type": "github"
} }
}, },
"git-hooks_2": {
"inputs": {
"flake-compat": [
"jj-cz",
"devenv",
"flake-compat"
],
"gitignore": "gitignore_2",
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760663237,
"narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -259,6 +485,29 @@
"type": "github" "type": "github"
} }
}, },
"gitignore_2": {
"inputs": {
"nixpkgs": [
"jj-cz",
"devenv",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -279,6 +528,30 @@
"type": "github" "type": "github"
} }
}, },
"jj-cz": {
"inputs": {
"alejandra": "alejandra",
"devenv": "devenv_2",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1774310517,
"narHash": "sha256-0wvZ4TBJM0pigw2ix1TWFT9CIKpYZSVu7jQDyM4e1jA=",
"ref": "refs/heads/develop",
"rev": "dda4aae87caf35cf03d5b1ce0e172807fa987e5c",
"revCount": 27,
"type": "git",
"url": "https://labs.phundrak.com/phundrak/jj-cz"
},
"original": {
"type": "git",
"url": "https://labs.phundrak.com/phundrak/jj-cz"
}
},
"nix": { "nix": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@@ -339,6 +612,52 @@
"type": "github" "type": "github"
} }
}, },
"nix_2": {
"inputs": {
"flake-compat": [
"jj-cz",
"devenv",
"flake-compat"
],
"flake-parts": [
"jj-cz",
"devenv",
"flake-parts"
],
"git-hooks-nix": [
"jj-cz",
"devenv",
"git-hooks"
],
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
],
"nixpkgs-23-11": [
"jj-cz",
"devenv"
],
"nixpkgs-regression": [
"jj-cz",
"devenv"
]
},
"locked": {
"lastModified": 1769708679,
"narHash": "sha256-uFKkp2/SjIqbu5HtINg/hwHN6qaqcxLIbL/om7dT3kI=",
"owner": "cachix",
"repo": "nix",
"rev": "72bec37fabbfe378d677868ec42eeb83acf07a4c",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "devenv-2.32",
"repo": "nix",
"type": "github"
}
},
"nixd": { "nixd": {
"inputs": { "inputs": {
"flake-parts": [ "flake-parts": [
@@ -366,6 +685,35 @@
"type": "github" "type": "github"
} }
}, },
"nixd_2": {
"inputs": {
"flake-parts": [
"jj-cz",
"devenv",
"flake-parts"
],
"flake-root": "flake-root_2",
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
],
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1763964548,
"narHash": "sha256-JTRoaEWvPsVIMFJWeS4G2isPo15wqXY/otsiHPN0zww=",
"owner": "nix-community",
"repo": "nixd",
"rev": "d4bf15e56540422e2acc7bc26b20b0a0934e3f5e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixd",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1772624091, "lastModified": 1772624091,
@@ -384,11 +732,11 @@
}, },
"pumo-system-info": { "pumo-system-info": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_3",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1748984111, "lastModified": 1748984111,
@@ -431,6 +779,7 @@
"copyparty": "copyparty", "copyparty": "copyparty",
"devenv": "devenv", "devenv": "devenv",
"home-manager": "home-manager", "home-manager": "home-manager",
"jj-cz": "jj-cz",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"pumo-system-info": "pumo-system-info", "pumo-system-info": "pumo-system-info",
@@ -440,7 +789,45 @@
"zen-browser": "zen-browser" "zen-browser": "zen-browser"
} }
}, },
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1730555913,
"narHash": "sha256-KNHZUlqsEibg3YtfUyOFQSofP8hp1HKoY+laoesBxRM=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "f17a5bbfd0969ba2e63a74505a80e55ecb174ed9",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rust-overlay": { "rust-overlay": {
"inputs": {
"nixpkgs": [
"jj-cz",
"nixpkgs"
]
},
"locked": {
"lastModified": 1770260791,
"narHash": "sha256-ADTBfENFjRVDQMcCycyX/pAy6NFI/Ct6Mrar3gsmXI0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "42ec85352e419e601775c57256a52f6d48a39906",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"pumo-system-info", "pumo-system-info",
@@ -486,7 +873,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_2" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1772494187, "lastModified": 1772494187,
@@ -552,6 +939,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -574,6 +976,29 @@
"type": "github" "type": "github"
} }
}, },
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"jj-cz",
"devenv",
"nixd",
"nixpkgs"
]
},
"locked": {
"lastModified": 1734704479,
"narHash": "sha256-MMi74+WckoyEWBRcg/oaGRvXC9BVVxDZNRMpL+72wBI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "65712f5af67234dad91a5a4baee986a8b62dbf8f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"zen-browser": { "zen-browser": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View File

@@ -29,6 +29,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
jj-cz = {
url = "git+https://labs.phundrak.com/phundrak/jj-cz";
inputs.nixpkgs.follows = "nixpkgs";
};
pumo-system-info = { pumo-system-info = {
url = "git+https://labs.phundrak.com/phundrak/pumo-system-info"; url = "git+https://labs.phundrak.com/phundrak/pumo-system-info";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View File

@@ -48,6 +48,10 @@ in {
enable = mkDefault true; enable = mkDefault true;
inherit (cfg) name email editor; inherit (cfg) name email editor;
signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content); signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content);
cz = {
enable = mkDefault true;
alias = mkDefault true;
};
}; };
}; };
} }

View File

@@ -2,10 +2,13 @@
lib, lib,
config, config,
pkgs, pkgs,
inputs,
... ...
}: }:
with lib; let with lib; let
inherit (pkgs.stdenv.hostPlatform) system;
cfg = config.home.dev.vcs.jj; cfg = config.home.dev.vcs.jj;
jj-cz = inputs.jj-cz.packages.${system}.default;
in { in {
options.home.dev.vcs.jj = { options.home.dev.vcs.jj = {
enable = mkEnableOption "enables jj"; enable = mkEnableOption "enables jj";
@@ -33,83 +36,91 @@ in {
description = "Path to the private SSH key for signing."; description = "Path to the private SSH key for signing.";
}; };
}; };
cz = {
enable = mkEnableOption "Enables jj-cz";
alias = mkEnableOption "Enable `jj cz` as an alias to `jj-cz`";
};
}; };
config.programs.jujutsu = mkIf cfg.enable { config = mkIf cfg.enable {
enable = true; home.packages = mkIf cfg.cz.enable [jj-cz];
settings = { programs.jujutsu = {
user = { enable = true;
inherit (cfg) name email; settings = {
}; user = {
ui = { inherit (cfg) name email;
default-command = "st"; };
pager = ":builtin"; ui = {
show-cryptographic-signatures = true; default-command = "st";
diff-editor = ":builtin"; pager = ":builtin";
merge-editort = ":builtin"; show-cryptographic-signatures = true;
inherit (cfg) editor; diff-editor = ":builtin";
}; merge-editort = ":builtin";
signing = mkIf cfg.signing.enable { inherit (cfg) editor;
behavior = "own"; };
backend = "ssh"; signing = mkIf cfg.signing.enable {
key = cfg.signing.sshKey; behavior = "own";
backends.ssh.allowed-signers = "${config.home.homeDirectory}/.ssh/allowed_signers"; backend = "ssh";
backends.ssh.program = "${pkgs.openssh}/bin/ssh-keygen"; key = cfg.signing.sshKey;
}; backends.ssh.allowed-signers = "${config.home.homeDirectory}/.ssh/allowed_signers";
aliases = { backends.ssh.program = "${pkgs.openssh}/bin/ssh-keygen";
blame = ["file" "annotate"]; };
consume = ["squash" "--into" "@" "--from"]; aliases = {
eject = ["squash" "--from" "@" "--into"]; blame = ["file" "annotate"];
d = ["diff"]; consume = ["squash" "--into" "@" "--from"];
dm = ["desc" "-m"]; cz = mkIf cfg.cz.alias ["util" "exec" "--" "${jj-cz}/bin/jj-cz"];
gc = ["git" "clone"]; eject = ["squash" "--from" "@" "--into"];
gcc = ["git" "clone" "--colocate"]; d = ["diff"];
l = ["log"]; dm = ["desc" "-m"];
la = ["log" "-r" "::"]; gc = ["git" "clone"];
lc = ["log" "-r" "(remote_bookmarks()..@)::"]; gcc = ["git" "clone" "--colocate"];
ll = ["log" "-T" "builtin_log_detailed"]; l = ["log"];
open = ["log" "-r" "open()"]; la = ["log" "-r" "::"];
n = ["new"]; lc = ["log" "-r" "(remote_bookmarks()..@)::"];
nd = ["new" "dev()"]; ll = ["log" "-T" "builtin_log_detailed"];
nt = ["new" "trunk()"]; open = ["log" "-r" "open()"];
revlog = ["evolog"]; n = ["new"];
s = ["show"]; nd = ["new" "dev()"];
tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"]; nt = ["new" "trunk()"];
}; revlog = ["evolog"];
colors.working_copy.underline = true; s = ["show"];
git = { tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"];
private-commits = "blacklist()"; };
colocate = true; colors.working_copy.underline = true;
subprocess = true; git = {
}; private-commits = "blacklist()";
revset-aliases = { colocate = true;
"immutable_heads()" = "present(trunk()) | tags()"; subprocess = true;
# Resolves by default to latest main/master remote bookmarks };
"trunk()" = "latest((present(main) | present(master)) & remote_bookmarks())"; revset-aliases = {
# Same as trunk() but for `dev` or `develop` bookmarks "immutable_heads()" = "present(trunk()) | tags()";
"dev()" = "latest((present(dev) | present(develop)) & remote_bookmarks())"; # Resolves by default to latest main/master remote bookmarks
"trunk()" = "latest((present(main) | present(master)) & remote_bookmarks())";
# Same as trunk() but for `dev` or `develop` bookmarks
"dev()" = "latest((present(dev) | present(develop)) & remote_bookmarks())";
"user(x)" = "author(x) | committer(x)"; "user(x)" = "author(x) | committer(x)";
"gh_pages()" = "ancestors(remote_bookmarks(exact:\"gh-pages\"))"; "gh_pages()" = "ancestors(remote_bookmarks(exact:\"gh-pages\"))";
#Private and WIP commits that should never be pushed #Private and WIP commits that should never be pushed
"wip()" = "description(glob:\"wip:*\")"; "wip()" = "description(glob:\"wip:*\")";
"private()" = "description(glob:\"private:*\")"; "private()" = "description(glob:\"private:*\")";
"blacklist()" = "wip() | private()"; "blacklist()" = "wip() | private()";
# stack(x, n) is the set of mutable commits reachable from # stack(x, n) is the set of mutable commits reachable from
# 'x', with 'n' parents. 'n' is often useful to customize the # 'x', with 'n' parents. 'n' is often useful to customize the
# display and return set for certain operations. 'x' can be # display and return set for certain operations. 'x' can be
# used to target the set of 'roots' to traverse, e.g. @ is the # used to target the set of 'roots' to traverse, e.g. @ is the
# current stack. # current stack.
"stack()" = "ancestors(reachable(@, mutable()), 2)"; "stack()" = "ancestors(reachable(@, mutable()), 2)";
"stack(x)" = "ancestors(reachable(x, mutable()), 2)"; "stack(x)" = "ancestors(reachable(x, mutable()), 2)";
"stack(x, n)" = "ancestors(reachable(x, mutable()), n)"; "stack(x, n)" = "ancestors(reachable(x, mutable()), n)";
"open()" = "stack(dev().. & mine(), 1)"; "open()" = "stack(dev().. & mine(), 1)";
"ready()" = "open() ~ blacklist()::"; "ready()" = "open() ~ blacklist()::";
};
remotes.origin.auto-track-bookmarks = "*";
}; };
remotes.origin.auto-track-bookmarks = "*";
}; };
}; };
} }