From 29fb7c5066132e12b98a6cb7a7f9ba3c5460d8c1 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 17 Nov 2025 13:57:48 +0000 Subject: [PATCH 01/13] home: discord: use upstream module --- modules/home/discord/default.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/home/discord/default.nix b/modules/home/discord/default.nix index bfa5d40..f9892df 100644 --- a/modules/home/discord/default.nix +++ b/modules/home/discord/default.nix @@ -1,8 +1,6 @@ { config, lib, pkgs, ... }: let cfg = config.my.home.discord; - - jsonFormat = pkgs.formats.json { }; in { options.my.home.discord = with lib; { @@ -12,14 +10,15 @@ in }; config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ - cfg.package - ]; + programs.discord = { + enable = true; - xdg.configFile."discord/settings.json".source = - jsonFormat.generate "discord.json" { + inherit (cfg) package; + + settings = { # Do not keep me from using the app just to force an update SKIP_HOST_UPDATE = true; }; + }; }; } From db9d8e76cfa2a82fb528066823d9cc315a7088d4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 17 Nov 2025 12:31:19 +0000 Subject: [PATCH 02/13] pkgs: diff-flake: add nix-darwin support --- pkgs/diff-flake/diff-flake | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pkgs/diff-flake/diff-flake b/pkgs/diff-flake/diff-flake index a2a3513..7a46151 100755 --- a/pkgs/diff-flake/diff-flake +++ b/pkgs/diff-flake/diff-flake @@ -24,6 +24,10 @@ current_system() { nix eval --raw --impure --expr 'builtins.currentSystem' } +add_darwin() { + FLAKE_OUTPUTS+=("darwinConfigurations.\"$1\".config.system.build.toplevel") +} + add_home() { FLAKE_OUTPUTS+=("homeConfigurations.\"$1\".activationPackage") } @@ -54,6 +58,10 @@ usage() { print_err " -p, --previous-rev" print_err " which git revision should be considered the 'previous' state," print_err " defaults to HEAD~" + print_err " --darwin [name]" + print_err " specify the name of a nix-darwin output configuration whose" + print_err " closure should be diffed, can be used multiple times" + print_err " if no host name is given, defaults to current hostname" print_err " --home [name]" print_err " specify the name of a home-manager output configuration whose" print_err " closure should be diffed, can be used multiple times" @@ -101,6 +109,14 @@ parse_args() { PREVIOUS_REV="$(git rev-parse "$1")" shift ;; + --darwin) + if [ $# -gt 0 ] && ! is_option "$1"; then + add_darwin "$1" + shift + else + add_darwin "$(hostname)" + fi + ;; --home) if [ $# -gt 0 ] && ! is_option "$1"; then add_home "$1" @@ -138,6 +154,12 @@ parse_args() { done } +list_darwin_configurations() { + nix eval '.#darwinConfigurations' \ + --apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \ + --raw +} + list_home_configurations() { nix eval '.#homeConfigurations' \ --apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \ @@ -175,6 +197,9 @@ diff_output() { parse_args "$@" if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then + for darwin in $(list_darwin_configurations); do + add_darwin "$darwin" + done for home in $(list_home_configurations); do add_home "$home" done From b553d21e568d6c19d5d6a939c97f94cbb4d32bf5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 17 Nov 2025 12:40:21 +0000 Subject: [PATCH 03/13] pkgs: diff-flake: add system-manager support --- pkgs/diff-flake/diff-flake | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pkgs/diff-flake/diff-flake b/pkgs/diff-flake/diff-flake index 7a46151..bacee6e 100755 --- a/pkgs/diff-flake/diff-flake +++ b/pkgs/diff-flake/diff-flake @@ -41,6 +41,10 @@ add_shell() { FLAKE_OUTPUTS+=("devShells.\"$(current_system)\".\"$1\".inputDerivation") } +add_system() { + FLAKE_OUTPUTS+=("systemConfigs.\"$1\".config.system.build.toplevel") +} + usage() { print_err "Usage: $0 [option]... [-- [nix build option]...]" print_err "" @@ -74,6 +78,10 @@ usage() { print_err " specify a specific devShell configuration name whose closure" print_err " should be diffed, can be used multiple times" print_err " if no name is given, defaults to 'default'" + print_err " --system [name]" + print_err " specify the name of a system-manager output configuration whose" + print_err " closure should be diffed, can be used multiple times" + print_err " if no host name is given, defaults to current hostname" print_err "" print_err "when no flake outputs are specified, automatically queries for" print_err "all NixOS configurations, and devShells for current system" @@ -141,6 +149,14 @@ parse_args() { add_shell "default" fi ;; + --system) + if [ $# -gt 0 ] && ! is_option "$1"; then + add_system "$1" + shift + else + add_system "$(hostname)" + fi + ;; --) NIX_BUILD_ARGS=("$@") break @@ -178,6 +194,12 @@ list_dev_shells() { --raw } +list_system_configurations() { + nix eval '.#systemConfigs' \ + --apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \ + --raw +} + diff_output() { local PREV NEW PREV="$(mktemp --dry-run)" @@ -209,6 +231,9 @@ if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then for shell in $(list_dev_shells); do add_shell "$shell" done + for system in $(list_system_configurations); do + add_system "$system" + done fi for out in "${FLAKE_OUTPUTS[@]}"; do From 649eb8974257a0da3f05defbc477a48acfab1901 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 17 Nov 2025 12:42:03 +0000 Subject: [PATCH 04/13] pkgs: diff-flake: rename 'host' to 'nixos' To avoid mixing them up with Nix-Darwin and System Manager hosts. --- pkgs/diff-flake/diff-flake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/diff-flake/diff-flake b/pkgs/diff-flake/diff-flake index bacee6e..f9290b9 100755 --- a/pkgs/diff-flake/diff-flake +++ b/pkgs/diff-flake/diff-flake @@ -32,7 +32,7 @@ add_home() { FLAKE_OUTPUTS+=("homeConfigurations.\"$1\".activationPackage") } -add_host() { +add_nixos() { FLAKE_OUTPUTS+=("nixosConfigurations.\"$1\".config.system.build.toplevel") } @@ -70,7 +70,7 @@ usage() { print_err " specify the name of a home-manager output configuration whose" print_err " closure should be diffed, can be used multiple times" print_err " if no configuration name is given, defaults to current username" - print_err " --host [name]" + print_err " --nixos [name]" print_err " specify the name of a NixOS output configuration whose" print_err " closure should be diffed, can be used multiple times" print_err " if no host name is given, defaults to current hostname" @@ -133,12 +133,12 @@ parse_args() { add_home "$USER" fi ;; - --host) + --nixos) if [ $# -gt 0 ] && ! is_option "$1"; then - add_host "$1" + add_nixos "$1" shift else - add_host "$(hostname)" + add_nixos "$(hostname)" fi ;; --shell) @@ -225,8 +225,8 @@ if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then for home in $(list_home_configurations); do add_home "$home" done - for host in $(list_nixos_configurations); do - add_host "$host" + for nixos in $(list_nixos_configurations); do + add_nixos "$nixos" done for shell in $(list_dev_shells); do add_shell "$shell" From 59e3c9a128b24e1c9c0a8efcd8d8ff47e18ce996 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 26 Feb 2025 10:51:31 +0000 Subject: [PATCH 05/13] home: add jujutsu This is a very basic configuration, still missing most bells and whistles. --- modules/home/default.nix | 1 + modules/home/jujutsu/default.nix | 67 ++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 modules/home/jujutsu/default.nix 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/jujutsu/default.nix b/modules/home/jujutsu/default.nix new file mode 100644 index 0000000..eaf56e9 --- /dev/null +++ b/modules/home/jujutsu/default.nix @@ -0,0 +1,67 @@ +{ 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 = [ "util" "exec" "--" "jj" ]; + lol = [ "log" "-r" "..@" "-T" "builtin_log_oneline" ]; + lola = [ "lol" "-r" "all()" ]; + }; + + "--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"; + }; + } + ]; + }; + }; + }; +} From 1c1f20a32470ba6d68801c9a033fd998688fd808 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 26 Feb 2025 10:51:31 +0000 Subject: [PATCH 06/13] home: delta: add 'jujutsu.enable' --- modules/home/delta/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/home/delta/default.nix b/modules/home/delta/default.nix index e76edc6..f652632 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 { @@ -20,6 +24,9 @@ in inherit (cfg) package; enableGitIntegration = cfg.git.enable; + # `jj log -p` does not use `delta` + # https://github.com/jj-vcs/jj/issues/4142 + enableJujutsuIntegration = cfg.jujutsu.enable; options = { features = "diff-highlight decorations"; From 09f20619ced405841a2deda6f0a2637f2d259e42 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 17 Mar 2025 12:43:12 +0000 Subject: [PATCH 07/13] home: jj: use verbose draft commit messages --- modules/home/jujutsu/default.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/home/jujutsu/default.nix b/modules/home/jujutsu/default.nix index eaf56e9..ff07448 100644 --- a/modules/home/jujutsu/default.nix +++ b/modules/home/jujutsu/default.nix @@ -40,6 +40,28 @@ in lola = [ "lol" "-r" "all()" ]; }; + 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(), + ) + ''; + "commit_description(commit)" = '' + concat( + commit.description(), "\n", + "JJ: This commit contains the following changes:\n", + indent("JJ: ", diff.stat(72)), + ) + ''; + }; + "--scope" = [ # Multiple identities { From 99b5412f834a4ce6109a205257e31b9f94b838ed Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 18 Mar 2025 14:59:23 +0000 Subject: [PATCH 08/13] home: jujutsu: explicitly create 'conf.d' This is to serve as a reminder of _how_ to add a local configuration file. --- modules/home/jujutsu/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/home/jujutsu/default.nix b/modules/home/jujutsu/default.nix index ff07448..573c588 100644 --- a/modules/home/jujutsu/default.nix +++ b/modules/home/jujutsu/default.nix @@ -85,5 +85,10 @@ in ]; }; }; + + # To drop in a `local.toml` configuration, not-versioned + xdg.configFile = { + "jj/conf.d/.keep".text = ""; + }; }; } From 22e4f07baf8198a9667feaf3de028c756f10144a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 11 Jul 2025 10:49:29 +0000 Subject: [PATCH 09/13] home: jujutsu: simplify 'jj jj' alias --- modules/home/jujutsu/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/home/jujutsu/default.nix b/modules/home/jujutsu/default.nix index 573c588..0c02813 100644 --- a/modules/home/jujutsu/default.nix +++ b/modules/home/jujutsu/default.nix @@ -35,7 +35,7 @@ in }; aliases = { - jj = [ "util" "exec" "--" "jj" ]; + jj = [ ]; lol = [ "log" "-r" "..@" "-T" "builtin_log_oneline" ]; lola = [ "lol" "-r" "all()" ]; }; From 515f4c58c965954e3c6106e3aac367da3891e51b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 22 Aug 2025 11:32:57 +0000 Subject: [PATCH 10/13] homes: bazin: use system jujutsu They have a custom `jj` with Piper CitC integration. --- hosts/homes/ambroisie@bazin/default.nix | 4 ++++ 1 file changed, 4 insertions(+) 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; From 6c9cb5d5d894b1565a99f9c3ffc2e4f10d2be3ef Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 22 Aug 2025 11:32:57 +0000 Subject: [PATCH 11/13] homes: mousqueton: use system jujutsu They have a custom `jj` with Piper CitC integration. --- hosts/homes/ambroisie@mousqueton/default.nix | 4 ++++ 1 file changed, 4 insertions(+) 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; From f80dc3f70716d0f3b2b9ad101e06c2b040be5144 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 27 Oct 2025 12:34:07 +0000 Subject: [PATCH 12/13] home: jujutsu: set 'home.diff-editor' Otherwise it keeps nagging me with a hint to set it. I'm not a big fan of this UI, I wish I add something closer to Git's patch interface. --- modules/home/jujutsu/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/home/jujutsu/default.nix b/modules/home/jujutsu/default.nix index 0c02813..7d44352 100644 --- a/modules/home/jujutsu/default.nix +++ b/modules/home/jujutsu/default.nix @@ -40,6 +40,11 @@ in lola = [ "lol" "-r" "all()" ]; }; + ui = { + # Stop nagging me about it, though I am not a fan of its UI. + diff-editor = ":builtin"; + }; + templates = { # Equivalent to `commit.verbose = true` in Git draft_commit_description = "commit_description_verbose(self)"; From b9b105a957372d37e6bdd70c4f92b3b17d1db654 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 26 Feb 2025 10:51:31 +0000 Subject: [PATCH 13/13] WIP: ADD NOTE FOR FUTURE SELF --- modules/home/jujutsu/default.nix | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/modules/home/jujutsu/default.nix b/modules/home/jujutsu/default.nix index 7d44352..986301b 100644 --- a/modules/home/jujutsu/default.nix +++ b/modules/home/jujutsu/default.nix @@ -36,8 +36,16 @@ in 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 = { @@ -45,6 +53,31 @@ in 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)"; @@ -58,6 +91,9 @@ in 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",