{ config, lib, pkgs, ... }: let cfg = config.hive.jj; in { options.hive.jj = { enable = lib.mkEnableOption "Enable jj vcs"; followGit = lib.mkOption { type = lib.types.bool; default = true; description = "Follow the current git configuration"; }; }; config = lib.mkIf cfg.enable { home.packages = with pkgs; [ jujutsu ]; programs.jujutsu = { enable = true; settings = { user = lib.optionalAttrs cfg.followGit { name = config.programs.git.userName; email = config.programs.git.userEmail; }; ui = lib.optionalAttrs (cfg.followGit && config.programs.git.difftastic.enable) { diff-formatter = ["${pkgs.difftastic}/bin/difft" "--color=always" "$left" "$right"]; }; }; }; }; }