From a43209a90227996e3b41f86a698a6d441020a1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sun, 15 Sep 2024 00:33:54 +0200 Subject: [PATCH] Add JJ --- hm/git/default.nix | 101 ++++++++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 37 deletions(-) diff --git a/hm/git/default.nix b/hm/git/default.nix index 8ffcc66..b7c42cb 100644 --- a/hm/git/default.nix +++ b/hm/git/default.nix @@ -1,6 +1,9 @@ { pkgs, lib, config, ... }: +let + cfg = config.programs.git; +in { - config = lib.mkIf config.programs.git.enable { + config = lib.mkIf cfg.enable { home.packages = [ (pkgs.writeShellApplication { name = "git-sync"; @@ -26,46 +29,70 @@ ); }) ]; - programs.git = { - package = pkgs.gitFull; - aliases = { - "git" = "!exec git"; # In case I write one too many git + programs = { + git = { + package = pkgs.gitFull; + aliases = { + "git" = "!exec git"; # In case I write one too many git + }; + ignores = [ + "*.swp" + "*.swo" + "*.ycm_extra_conf.py" + "tags" + ".mypy_cache" + ]; + delta = { + enable = true; + options = { + line-numbers = true; + syntax-theme = "base16"; + }; + }; + # Also tried difftastic, and while I like the default theme it's a bit + # less configurable + lfs.enable = true; + userEmail = lib.mkDefault "geoffrey@frogeye.fr"; + userName = lib.mkDefault "Geoffrey Frogeye"; + extraConfig = { + core = { + editor = "nvim"; + }; + push = { + default = "matching"; + }; + pull = { + ff = "only"; + }; + } // lib.optionalAttrs config.frogeye.desktop.xorg { + diff.tool = "meld"; + difftool.prompt = false; + "difftool \"meld\"".cmd = "${pkgs.meld}/bin/meld \"$LOCAL\" \"$REMOTE\""; + # This escapes quotes, which isn't the case in the original, hoping this isn't an issue. + }; }; - ignores = [ - "*.swp" - "*.swo" - "*.ycm_extra_conf.py" - "tags" - ".mypy_cache" - ]; - delta = { + jujutsu = { enable = true; - options = { - line-numbers = true; - syntax-theme = "base16"; + settings = { + git.auto-local-bookmark = true; + user = { + email = cfg.userEmail; + name = cfg.userName; + }; + ui = { + pager = "delta"; + diff.format = "git"; + diff-editor = "meld-3"; + merge-editor = "meld"; + }; + signing = { + sign-all = true; + backend = "gpg"; + inherit (cfg.signing) key; + backends.gpg.allow-expired-keys = false; + }; }; }; - # Also tried difftastic, and while I like the default theme it's a bit - # less configurable - lfs.enable = true; - userEmail = lib.mkDefault "geoffrey@frogeye.fr"; - userName = lib.mkDefault "Geoffrey Frogeye"; - extraConfig = { - core = { - editor = "nvim"; - }; - push = { - default = "matching"; - }; - pull = { - ff = "only"; - }; - } // lib.optionalAttrs config.frogeye.desktop.xorg { - diff.tool = "meld"; - difftool.prompt = false; - "difftool \"meld\"".cmd = "${pkgs.meld}/bin/meld \"$LOCAL\" \"$REMOTE\""; - # This escapes quotes, which isn't the case in the original, hoping this isn't an issue. - }; }; services = { git-sync = {