home-manager @ 0b35db5b683065569b0ea9282e40a7b7e1530324

Add jj configuration
 1diff --git a/flake.nix b/flake.nix
 2index ba25103f8165a8ffd30366ced40c2d3670bc1548..8172575a17c0a9fc23864a30138bfa592d6adaee 100644
 3--- a/flake.nix
 4+++ b/flake.nix
 5@@ -30,6 +30,10 @@         inherit pkgs;
 6 
 7         extraSpecialArgs = {
 8           inherit inputs;
 9+          git = {
10+            name = "Gabriel A. Giovanini";
11+            email = "g.arakakigiovanini@gridx.de";
12+          };
13         };
14 
15         modules = [
16@@ -42,6 +46,10 @@         inherit pkgs;
17 
18         extraSpecialArgs = {
19           inherit inputs;
20+          git = {
21+            name = "Gabriel A. Giovanini";
22+            nmail = "mail@gabrielgio.me";
23+          };
24         };
25 
26         modules = [
27diff --git a/home.nix b/home.nix
28index 90ba49452a56cf6c5f2f651e57f18d764206c497..9aeff475dd71aecc0a88a82973d54f82ff170f01 100644
29--- a/home.nix
30+++ b/home.nix
31@@ -57,5 +57,6 @@     (import ./alacritty.nix)
32     (import ./niri.nix)
33     (import ./sway.nix)
34     (import ./aerc.nix)
35+    (import ./jj.nix)
36   ];
37 }
38diff --git a/jj.nix b/jj.nix
39new file mode 100644
40index 0000000000000000000000000000000000000000..c74bf17fc6907cf00c1fb9a2b238eb61d12a1e10
41--- /dev/null
42+++ b/jj.nix
43@@ -0,0 +1,36 @@
44+{
45+  pkgs,
46+  inputs,
47+  git,
48+  ...
49+}: let
50+  tomlFormat = pkgs.formats.toml {};
51+in {
52+  xdg.configFile."jj/config.toml".source = tomlFormat.generate "config.toml" {
53+    user = {
54+      name = git.name;
55+      email = git.email;
56+    };
57+    ui = {
58+      diff-formatter = ":git";
59+      pager = ":builtin";
60+    };
61+    aliases = {
62+      wk = ["log" "-r" "trunk()::@ | @::"];
63+      gp = ["git" "push" "--allow-new"];
64+      gf = ["git" "fetch"];
65+      tracked = ["bookmark" "list" "-t" "-T" ''if(self.tracked(), if(self.name() != "main", self.name()++"\n"))''];
66+      untracked = ["bookmark" "list" "-T" ''if(!self.tracked(), if(self.name() != "main", self.name()++"\n"))''];
67+      e = ["edit"];
68+      track = ["util" "exec" "--" "bash" "-c" "jj bookmark set $(jj log -r @ -T 'self.change_id()' --no-graph)"];
69+      tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"];
70+      nm = ["new" "-r" "trunk()"];
71+    };
72+    templates = {
73+      log = "builtin_log_compact";
74+    };
75+    template-aliases = {
76+      "commit_timestamp(commit)" = "commit.author().timestamp()";
77+    };
78+  };
79+}