Compare commits
17 commits
af7280187a
...
39a61a31dc
| Author | SHA1 | Date | |
|---|---|---|---|
| 39a61a31dc | |||
| a313256f6a | |||
| 5d39c5a897 | |||
| 3f36d83790 | |||
| 3704f8e900 | |||
| d02fa648fa | |||
| 61184c4c85 | |||
| a704413c3a | |||
| 71b522e48c | |||
| 49c2a78d5f | |||
| 9c28883e7a | |||
| 8c5df1f88a | |||
| b159ccec67 | |||
| dadaaef7cc | |||
| 326c452fd2 | |||
| bf428aaeca | |||
| ddc6cd37ad |
8 changed files with 226 additions and 28 deletions
24
flake.lock
generated
24
flake.lock
generated
|
|
@ -117,11 +117,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1763988335,
|
||||
"narHash": "sha256-QlcnByMc8KBjpU37rbq5iP7Cp97HvjRP0ucfdh+M4Qc=",
|
||||
"lastModified": 1765464257,
|
||||
"narHash": "sha256-dixPWKiHzh80PtD0aLuxYNQ0xP+843dfXG/yM3OzaYQ=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "50b9238891e388c9fdc6a5c49e49c42533a1b5ce",
|
||||
"rev": "09e45f2598e1a8499c3594fe11ec2943f34fe509",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -159,11 +159,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764361670,
|
||||
"narHash": "sha256-jgWzgpIaHbL3USIq0gihZeuy1lLf2YSfwvWEwnfAJUw=",
|
||||
"lastModified": 1765480374,
|
||||
"narHash": "sha256-HlbvQAqLx7WqZFFQZ8nu5UUJAVlXiV/kqKbyueA8srw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "780be8ef503a28939cf9dc7996b48ffb1a3e04c6",
|
||||
"rev": "39cb677ed9e908e90478aa9fe5f3383dfc1a63f3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -175,11 +175,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764242076,
|
||||
"narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=",
|
||||
"lastModified": 1765186076,
|
||||
"narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4",
|
||||
"rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -199,11 +199,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764449851,
|
||||
"narHash": "sha256-VnodC1+3KML8MYLLnK84E6U2Fz4ioNacOeQd1pMCSTw=",
|
||||
"lastModified": 1765481746,
|
||||
"narHash": "sha256-oWDp4EMOXvPZSC5ZVdg90K7EFgUGvxmrFAwA/1hJ/j4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "b1781c0aa8935d8d1f35d228bcc7127fcebcd363",
|
||||
"rev": "2b2d6d53d6a66d1be2d8620024cc61ad986bcee2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
./gtk
|
||||
./htop
|
||||
./jq
|
||||
./jujutsu
|
||||
./keyboard
|
||||
./mail
|
||||
./mpv
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
141
modules/home/jujutsu/default.nix
Normal file
141
modules/home/jujutsu/default.nix
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
{ 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";
|
||||
# I don't like word-diff
|
||||
diff-formatter = ":git";
|
||||
# Stop nagging me about it, though I am not a fan of its UI.
|
||||
merge-editor = ":builtin";
|
||||
# Does not honor `$PAGER` (anymore)
|
||||
pager = lib.mkDefault config.home.sessionVariables.PAGER;
|
||||
};
|
||||
|
||||
# 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 = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -15,8 +15,6 @@ in
|
|||
|
||||
amd = {
|
||||
enableKernelModule = lib.my.mkDisableOption "Kernel driver module";
|
||||
|
||||
amdvlk = lib.mkEnableOption "Use AMDVLK instead of Mesa RADV driver";
|
||||
};
|
||||
|
||||
intel = {
|
||||
|
|
@ -35,13 +33,6 @@ in
|
|||
(lib.mkIf (cfg.gpuFlavor == "amd") {
|
||||
hardware.amdgpu = {
|
||||
initrd.enable = cfg.amd.enableKernelModule;
|
||||
# Vulkan
|
||||
amdvlk = lib.mkIf cfg.amd.amdvlk {
|
||||
enable = true;
|
||||
support32Bit = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hardware.graphics = {
|
||||
|
|
|
|||
|
|
@ -24,11 +24,15 @@ 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")
|
||||
}
|
||||
|
||||
add_host() {
|
||||
add_nixos() {
|
||||
FLAKE_OUTPUTS+=("nixosConfigurations.\"$1\".config.system.build.toplevel")
|
||||
}
|
||||
|
||||
|
|
@ -37,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 ""
|
||||
|
|
@ -54,11 +62,15 @@ 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"
|
||||
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"
|
||||
|
|
@ -66,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"
|
||||
|
|
@ -101,6 +117,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"
|
||||
|
|
@ -109,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)
|
||||
|
|
@ -125,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
|
||||
|
|
@ -138,6 +170,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)' \
|
||||
|
|
@ -156,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)"
|
||||
|
|
@ -175,15 +219,21 @@ 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
|
||||
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"
|
||||
done
|
||||
for system in $(list_system_configurations); do
|
||||
add_system "$system"
|
||||
done
|
||||
fi
|
||||
|
||||
for out in "${FLAKE_OUTPUTS[@]}"; do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue