diff --git a/flake.lock b/flake.lock index f56e8f2..725e17c 100644 --- a/flake.lock +++ b/flake.lock @@ -14,11 +14,11 @@ ] }, "locked": { - "lastModified": 1760836749, - "narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=", + "lastModified": 1761656077, + "narHash": "sha256-lsNWuj4Z+pE7s0bd2OKicOFq9bK86JE0ZGeKJbNqb94=", "owner": "ryantm", "repo": "agenix", - "rev": "2f0f812f69f3eb4140157fe15e12739adf82e32a", + "rev": "9ba0d85de3eaa7afeab493fed622008b6e4924f5", "type": "github" }, "original": { @@ -73,11 +73,11 @@ ] }, "locked": { - "lastModified": 1760948891, - "narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=", + "lastModified": 1762040540, + "narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04", + "rev": "0010412d62a25d959151790968765a70c436598b", "type": "github" }, "original": { @@ -159,11 +159,11 @@ ] }, "locked": { - "lastModified": 1761530345, - "narHash": "sha256-+9+YCK9Lh6GThkXu/8JTxMFUnImIdZpb8ElUh6/F5Y8=", + "lastModified": 1762435363, + "narHash": "sha256-BTmHXtuuwVO1dRs6jPHcHCoO6+A7G3+GzrgeluiSkww=", "owner": "nix-community", "repo": "home-manager", - "rev": "bbaeb9f1c29e79bb1653b32c3d73244cdf4bd888", + "rev": "432bc8a5da66638b5f139588efd6c4bd327e4cdc", "type": "github" }, "original": { @@ -175,11 +175,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1761373498, - "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=", + "lastModified": 1762111121, + "narHash": "sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce", + "rev": "b3d51a0365f6695e7dd5cdf3e180604530ed33b4", "type": "github" }, "original": { diff --git a/flake/overlays.nix b/flake/overlays.nix index 0c47989..c10afc3 100644 --- a/flake/overlays.nix +++ b/flake/overlays.nix @@ -1,4 +1,4 @@ -{ self, ... }: +{ self, lib, ... }: let default-overlays = import "${self}/overlays"; @@ -8,7 +8,7 @@ let # Expose my custom packages pkgs = _final: prev: { - ambroisie = prev.recurseIntoAttrs (import "${self}/pkgs" { pkgs = prev; }); + ambroisie = lib.recurseIntoAttrs (import "${self}/pkgs" { pkgs = prev; }); }; }; in diff --git a/hosts/homes/ambroisie@bazin/default.nix b/hosts/homes/ambroisie@bazin/default.nix index 365b70d..9ef2642 100644 --- a/hosts/homes/ambroisie@bazin/default.nix +++ b/hosts/homes/ambroisie@bazin/default.nix @@ -22,6 +22,10 @@ package = pkgs.emptyDirectory; }; + jujutsu = { + package = pkgs.emptyDirectory; + }; + tmux = { # I use scripts that use the passthrough sequence often on this host enablePassthrough = true; diff --git a/hosts/homes/ambroisie@mousqueton/default.nix b/hosts/homes/ambroisie@mousqueton/default.nix index 1383618..1ffee2b 100644 --- a/hosts/homes/ambroisie@mousqueton/default.nix +++ b/hosts/homes/ambroisie@mousqueton/default.nix @@ -25,6 +25,10 @@ package = pkgs.emptyDirectory; }; + jujutsu = { + package = pkgs.emptyDirectory; + }; + tmux = { # I use scripts that use the passthrough sequence often on this host enablePassthrough = true; diff --git a/modules/home/default.nix b/modules/home/default.nix index ad3b979..eb3d0f2 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -24,6 +24,7 @@ ./gtk ./htop ./jq + ./jujutsu ./keyboard ./mail ./mpv diff --git a/modules/home/delta/default.nix b/modules/home/delta/default.nix index e76edc6..3d64c20 100644 --- a/modules/home/delta/default.nix +++ b/modules/home/delta/default.nix @@ -11,6 +11,10 @@ in git = { enable = my.mkDisableOption "git integration"; }; + + jujutsu = { + enable = my.mkDisableOption "jujutsu integration"; + }; }; config = lib.mkIf cfg.enable { @@ -45,5 +49,27 @@ in }; }; }; + + # `jj log -p` does not use `delta` + # https://github.com/jj-vcs/jj/issues/4142 + # FIXME: use `enableJujutsuIntegration` (https://github.com/nix-community/home-manager/pull/8070) + programs.jujutsu = lib.mkIf cfg.jujutsu.enable { + settings = { + merge-tools = { + delta = { + # Errors are signaled with exit codes greater or equal to 2 + diff-expected-exit-codes = [ 0 1 ]; + }; + }; + + ui = { + # Delta expects a `git diff` input + diff-formatter = ":git"; + + # `finalPackage` automatically applied `--config` if necessary + pager = [ (lib.getExe config.programs.delta.finalPackage) ]; + }; + }; + }; }; } diff --git a/modules/home/jujutsu/default.nix b/modules/home/jujutsu/default.nix new file mode 100644 index 0000000..986301b --- /dev/null +++ b/modules/home/jujutsu/default.nix @@ -0,0 +1,135 @@ +{ 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"; + + package = mkPackageOption pkgs "jujutsu" { }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + # For `jj git` commands + 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 = [ ]; + # FIXME: + # * still not a big fan of the template + lol = [ "log" "-r" "..@" "-T" "builtin_log_oneline" ]; + lola = [ "lol" "-r" "all()" ]; + # FIXME: equivalent to `git switch -` + # See https://github.com/jj-vcs/jj/issues/2871 + # Might be broken recently https://discord.com/channels/968932220549103686/1380272574709366989/1380432041983606855 + # TODO: + # * `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) + }; + + ui = { + # Stop nagging me about it, though I am not a fan of its UI. + diff-editor = ":builtin"; + }; + + # FIXME: git equivalents + # I'd like a better formatted blame (more like delta's?) + # blame = { + # coloring = "repeatedLines"; + # markIgnoredLines = true; + # markUnblamables = true; + # }; + # FIXME: log colors should probably match git + # FIXME: patience diff? + # FIXME: fetch prune/pruneTags? + # FIXME: pull.rebase=true? Probably true TBH + # FIXME: push.default=simple? Probably true TBH + # FIXME: conflict style? ui.conflict-marker-style=git is diff3, not zdiff3. Default looks fine-ish + + # FIXME: from ma_9's config, plus my own stuff + # snapshot = { + # auto-track = "none()"; + # }; + # + # ui = { + # movement = { + # edit = false; + # }; + # }; + + templates = { + # Equivalent to `commit.verbose = true` in Git + draft_commit_description = "commit_description_verbose(self)"; + }; + + template-aliases = { + "commit_description_verbose(commit)" = '' + concat( + commit_description(commit), + "JJ: ignore-rest\n", + diff.git(), + ) + ''; + # FIXME: use `diff.summary()` instead? Supported by syntax highlighting + # See https://github.com/jj-vcs/jj/issues/1946#issuecomment-2572986485 + # FIXME: tree-sitter grammar isn't in `nvim-treesitter` (https://github.com/kareigu/tree-sitter-jjdescription) + "commit_description(commit)" = '' + concat( + commit.description(), "\n", + "JJ: This commit contains the following changes:\n", + indent("JJ: ", diff.stat(72)), + ) + ''; + }; + + "--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"; + }; + } + ]; + }; + }; + + # To drop in a `local.toml` configuration, not-versioned + xdg.configFile = { + "jj/conf.d/.keep".text = ""; + }; + }; +} diff --git a/modules/home/vim/ftdetect/glsl.lua b/modules/home/vim/ftdetect/glsl.lua deleted file mode 100644 index 2f4f1dd..0000000 --- a/modules/home/vim/ftdetect/glsl.lua +++ /dev/null @@ -1,7 +0,0 @@ --- Use GLSL filetype for common shader file extensions -vim.filetype.add({ - extension = { - frag = "glsl", - vert = "glsl", - }, -}) diff --git a/modules/home/vim/init.vim b/modules/home/vim/init.vim index 39ef32e..1142925 100644 --- a/modules/home/vim/init.vim +++ b/modules/home/vim/init.vim @@ -81,9 +81,6 @@ set updatetime=250 " Disable all mouse integrations set mouse= -" Set dark mode by default -set background=dark - " Setup some overrides for gruvbox lua << EOF local gruvbox = require("gruvbox")