nix-config/modules/home/jujutsu/default.nix
Bruno BELANYI 776c47e35e
Some checks failed
ci/woodpecker/push/check Pipeline failed
WIP: add jujutsu (w/ Delta)
2025-02-26 11:01:28 +00:00

93 lines
2.2 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.my.home.jujutsu;
inherit (lib.my) mkMailAddress;
in
{
options.my.home.jujutsu = with lib; {
enable = my.mkDisableOption "jujutsu configuration";
# I want the full experience by default
package = mkPackageOption pkgs "jujutsu" { };
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = cfg.enable -> config.my.home.git.enable;
message = ''
`config.my.home.jujutsu` relies on `config.my.home.git` being enabled.
'';
}
];
programs.jujutsu = {
enable = true;
inherit (cfg) package;
settings = {
# Who am I?
user = {
name = "Bruno BELANYI";
email = mkMailAddress "bruno" "belanyi.fr";
};
aliases = {
jj = [ "util" "exec" "--" "jj" ];
# TODO:
# * maybe `lol` and `lola` equivalent
# * `pick` (https://github.com/jj-vcs/jj/issues/5446): [ "util" "exec" "--" "bash" "-c" "jj log -p -r \"diff_contains($1)\"" ]
# * `root`: `jj workspace root` (barely necessary then)
};
git = {
subprocess = true;
};
# FIXME: `extraConfig` equivalents...
# FIXME: from ma_9's config, plus my own stuff
# revsets = {
# # git-style log of the entire repo by default
# log = "..@";
# }
# snapshot = {
# auto-track = "none()";
# };
#
# ui = {
# # default-command = "log"; "log-wip"?
# diff-editor = ":builtin";
# movement = {
# edit = false;
# };
# };
"--scope" = [
# Multiple identities
{
"--when" = {
repositories = [ "~/git/EPITA/" ];
};
user = {
name = "Bruno BELANYI";
email = mkMailAddress "bruno.belanyi" "epita.fr";
};
}
{
"--when" = {
repositories = [ "~/git/work/" ];
};
user = {
name = "Bruno BELANYI";
email = mkMailAddress "ambroisie" "google.com";
};
}
];
};
};
};
}