Compare commits
9 commits
85c38b1337
...
dead2042d5
| Author | SHA1 | Date | |
|---|---|---|---|
| dead2042d5 | |||
| f6d0d561c5 | |||
| d9702e4de5 | |||
| 423f60774c | |||
| 212f80695a | |||
| 7786c591b5 | |||
| 4b7c6c1f5e | |||
| 2a515754a2 | |||
| add7967685 |
6 changed files with 172 additions and 20 deletions
18
flake.lock
generated
18
flake.lock
generated
|
|
@ -73,11 +73,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1751413152,
|
"lastModified": 1753121425,
|
||||||
"narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
|
"narHash": "sha256-TVcTNvOeWWk1DXljFxVRp+E0tzG1LhrVjOGGoMHuXio=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
|
"rev": "644e0fc48951a860279da645ba77fe4a6e814c5e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -159,11 +159,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1752467539,
|
"lastModified": 1753617834,
|
||||||
"narHash": "sha256-4kaR+xmng9YPASckfvIgl5flF/1nAZOplM+Wp9I5SMI=",
|
"narHash": "sha256-WEVfKrdIdu5CpppJ0Va3vzP0DKlS+ZTLbBjugMO2Drg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "1e54837569e0b80797c47be4720fab19e0db1616",
|
"rev": "72cc1e3134a35005006f06640724319caa424737",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -175,11 +175,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1752644555,
|
"lastModified": 1753429684,
|
||||||
"narHash": "sha256-oeRcp4VEyZ/3ZgfRRoq60/08l2zy0K53l8MdfSIYd24=",
|
"narHash": "sha256-9h7+4/53cSfQ/uA3pSvCaBepmZaz/dLlLVJnbQ+SJjk=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9100a4f6bf446603b9575927c8585162f9ec9aa6",
|
"rev": "7fd36ee82c0275fb545775cc5e4d30542899511d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
./gtk
|
./gtk
|
||||||
./htop
|
./htop
|
||||||
./jq
|
./jq
|
||||||
|
./jujutsu
|
||||||
./keyboard
|
./keyboard
|
||||||
./mail
|
./mail
|
||||||
./mpv
|
./mpv
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ in
|
||||||
git = {
|
git = {
|
||||||
enable = my.mkDisableOption "git integration";
|
enable = my.mkDisableOption "git integration";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jujutsu = {
|
||||||
|
enable = my.mkDisableOption "jujutsu integration";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
@ -30,6 +34,13 @@ in
|
||||||
enabled.
|
enabled.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.jujutsu.enable -> cfg.git.enable;
|
||||||
|
message = ''
|
||||||
|
`config.my.home.delta.jujutsu` relies on `config.my.home.delta.git`
|
||||||
|
being enabled.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
@ -64,5 +75,23 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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";
|
||||||
|
|
||||||
|
pager = "${lib.getExe cfg.package}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
130
modules/home/jujutsu/default.nix
Normal file
130
modules/home/jujutsu/default.nix
Normal file
|
|
@ -0,0 +1,130 @@
|
||||||
|
{ 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)
|
||||||
|
};
|
||||||
|
|
||||||
|
# FIXME: git equivalents
|
||||||
|
# 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 = {
|
||||||
|
# diff-editor = ":builtin"; # To silence hints
|
||||||
|
# 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 = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,6 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.my.home.zsh;
|
cfg = config.my.home.zsh;
|
||||||
|
|
||||||
# Have a nice relative path for XDG_CONFIG_HOME, without leading `/`
|
|
||||||
relativeXdgConfig =
|
|
||||||
let
|
|
||||||
noHome = lib.removePrefix config.home.homeDirectory;
|
|
||||||
noSlash = lib.removePrefix "/";
|
|
||||||
in
|
|
||||||
noSlash (noHome config.xdg.configHome);
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.home.zsh = with lib; {
|
options.my.home.zsh = with lib; {
|
||||||
|
|
@ -57,7 +49,7 @@ in
|
||||||
|
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dotDir = "${relativeXdgConfig}/zsh"; # Don't clutter $HOME
|
dotDir = "${config.xdg.configHome}/zsh"; # Don't clutter $HOME
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
|
||||||
history = {
|
history = {
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ usage() {
|
||||||
|
|
||||||
find_program() {
|
find_program() {
|
||||||
local CANDIDATE
|
local CANDIDATE
|
||||||
CANDIDATE="$(nix-locate --top-level --minimal --at-root --whole-name "/bin/$1")"
|
CANDIDATE="$(nix-locate --minimal --at-root --whole-name "/bin/$1")"
|
||||||
if [ "$(printf '%s\n' "$CANDIDATE" | wc -l)" -gt 1 ]; then
|
if [ "$(printf '%s\n' "$CANDIDATE" | wc -l)" -gt 1 ]; then
|
||||||
CANDIDATE="$(printf '%s' "$CANDIDATE" | fzf-tmux)"
|
CANDIDATE="$(printf '%s' "$CANDIDATE" | "${COMMA_PICKER:-fzf-tmux}")"
|
||||||
fi
|
fi
|
||||||
printf '%s' "$CANDIDATE"
|
printf '%s' "$CANDIDATE"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue