2025-05-22 20:01:01 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
2025-09-04 23:23:06 +02:00
|
|
|
self,
|
2025-05-22 20:01:01 +02:00
|
|
|
...
|
2025-07-20 01:23:48 +02:00
|
|
|
}:
|
|
|
|
let
|
2025-05-22 20:01:01 +02:00
|
|
|
inherit (lib.meta) getExe;
|
2025-09-02 21:50:56 +02:00
|
|
|
inherit (lib.lists) singleton;
|
2025-09-04 23:23:06 +02:00
|
|
|
inherit (lib.modules) mkIf;
|
2025-09-02 20:34:08 +02:00
|
|
|
|
|
|
|
inherit (config.meta.mainUser) username;
|
2025-09-02 21:50:56 +02:00
|
|
|
inherit (config.meta.system) isWorkstation;
|
2025-09-02 20:34:08 +02:00
|
|
|
|
2025-07-20 01:23:48 +02:00
|
|
|
toml = pkgs.formats.toml { };
|
2025-05-22 20:01:01 +02:00
|
|
|
jj-config = toml.generate "config.toml" {
|
|
|
|
user = {
|
2025-09-02 20:34:08 +02:00
|
|
|
email = "fau@faukah.com";
|
|
|
|
name = "faukah";
|
2025-05-22 20:01:01 +02:00
|
|
|
};
|
|
|
|
aliases = {
|
2025-07-20 01:23:48 +02:00
|
|
|
c = [ "commit" ];
|
|
|
|
ci = [
|
|
|
|
"commit"
|
|
|
|
"--interactive"
|
|
|
|
];
|
|
|
|
e = [ "edit" ];
|
2025-09-02 20:34:08 +02:00
|
|
|
i = [
|
|
|
|
"git"
|
|
|
|
"init"
|
|
|
|
"--colocate"
|
|
|
|
];
|
2025-07-20 01:23:48 +02:00
|
|
|
nb = [
|
|
|
|
"bookmark"
|
|
|
|
"create"
|
|
|
|
"-r @-"
|
|
|
|
];
|
|
|
|
pull = [
|
|
|
|
"git"
|
|
|
|
"fetch"
|
|
|
|
];
|
|
|
|
push = [
|
|
|
|
"git"
|
|
|
|
"push"
|
|
|
|
"--allow-new"
|
|
|
|
];
|
|
|
|
r = [ "rebase" ];
|
|
|
|
s = [ "squash" ];
|
|
|
|
si = [
|
|
|
|
"squash"
|
|
|
|
"--interactive"
|
|
|
|
];
|
|
|
|
tug = [
|
|
|
|
"bookmark"
|
|
|
|
"move"
|
|
|
|
"--from"
|
|
|
|
"closest_bookmark(@-)"
|
|
|
|
"--to"
|
|
|
|
"@-"
|
|
|
|
];
|
2025-05-22 20:01:01 +02:00
|
|
|
};
|
2025-09-04 23:23:06 +02:00
|
|
|
git = {
|
|
|
|
# colocate = true;
|
|
|
|
push-new-bookmarks = true;
|
|
|
|
};
|
2025-09-02 20:34:08 +02:00
|
|
|
revset-aliases."closest_bookmark(to)" = "heads(::to & bookmarks())";
|
|
|
|
signing = {
|
|
|
|
backend = "ssh";
|
|
|
|
behavior = "drop";
|
|
|
|
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPiRe9OH/VtWFWyy5QbAVcN7CLxr4zUtRCwmxD6aeN6";
|
|
|
|
};
|
|
|
|
template-aliases = {
|
|
|
|
"format_short_id(id)" = "id.shortest()";
|
|
|
|
"format_timestamp(timestamp)" = "timestamp.ago()";
|
2025-05-22 20:01:01 +02:00
|
|
|
};
|
|
|
|
templates = {
|
|
|
|
draft_commit_description = ''
|
|
|
|
concat(
|
|
|
|
coalesce(description, "\n"),
|
|
|
|
surround(
|
|
|
|
"\nJJ: This commit contains the following changes:\n", "",
|
|
|
|
indent("JJ: ", diff.stat(72)),
|
|
|
|
),
|
|
|
|
"\nJJ: ignore-rest\n",
|
|
|
|
diff.git(),
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
};
|
2025-09-02 20:34:08 +02:00
|
|
|
ui = {
|
|
|
|
default-command = "log";
|
2025-09-04 23:23:06 +02:00
|
|
|
diff-editor = ":builtin";
|
2025-09-02 20:34:08 +02:00
|
|
|
diff-formatter = [
|
|
|
|
"${getExe pkgs.difftastic}"
|
|
|
|
"--color"
|
|
|
|
"always"
|
|
|
|
"$left"
|
|
|
|
"$right"
|
|
|
|
];
|
|
|
|
movement = {
|
|
|
|
edit = true;
|
|
|
|
};
|
|
|
|
pager = [
|
|
|
|
"${getExe pkgs.bat}"
|
|
|
|
"--plain"
|
|
|
|
];
|
2025-05-22 20:01:01 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2025-09-04 23:23:06 +02:00
|
|
|
inherit (config.age.secrets) organizationScope uniScope;
|
2025-09-02 21:50:56 +02:00
|
|
|
jj-wrapped = pkgs.symlinkJoin {
|
|
|
|
name = "jj-wrapped";
|
2025-09-04 23:23:06 +02:00
|
|
|
paths = singleton [ pkgs.jujutsu ];
|
2025-09-02 21:50:56 +02:00
|
|
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
2025-09-04 23:23:06 +02:00
|
|
|
postBuild = ''
|
|
|
|
wrapProgram $out/bin/jj --add-flags " --config-file ${organizationScope.path} --config-file ${uniScope.path}"
|
2025-09-02 21:50:56 +02:00
|
|
|
'';
|
|
|
|
};
|
2025-07-20 01:23:48 +02:00
|
|
|
in
|
|
|
|
{
|
2025-09-02 20:34:08 +02:00
|
|
|
hjem.users.${username}.xdg.config.files."jj/config.toml".source = jj-config;
|
2025-09-04 23:23:06 +02:00
|
|
|
age.secrets.organizationScope = mkIf isWorkstation {
|
|
|
|
file = "${self}/secrets/organization_scope.age";
|
|
|
|
owner = username;
|
|
|
|
};
|
|
|
|
age.secrets.uniScope = mkIf isWorkstation {
|
|
|
|
file = "${self}/secrets/uni_scope.age";
|
|
|
|
owner = username;
|
|
|
|
};
|
|
|
|
environment.systemPackages = singleton (if isWorkstation then jj-wrapped else pkgs.jujutsu);
|
|
|
|
|
2025-05-22 20:01:01 +02:00
|
|
|
}
|