Compare commits

...

3 commits

Author SHA1 Message Date
2bd6501c1b WIP: home: delta: use stand-alone configuration file
All checks were successful
ci/woodpecker/push/check Pipeline was successful
Ideally, I'd like for `delta` to just read a configuration file at
`$XDG_CONFIG_HOME/delta/config` by default, but upstream seems somewhat
reticent to the idea :-/.

TODO:
* `git.enable = false` would break the standalone configuration
* using a wrapper which sets `--config` might be better than includes
2025-02-24 12:39:46 +00:00
575c416d97 home: git: use 'mkAfter' for local config include
This should ensure that it will be included at the very end of the
configuration, allowing it to override any other options in the file.

Not sure that I _really_ need it, but it's tidier this way.
2025-02-24 12:38:02 +00:00
88944c7d1e home: git: extract 'delta' configuration
I want to be able to re-use it between different source control systems
(e.g: `jj`).

As a first step, extract it to a proper module so that I can have it
live in a single space.
2025-02-24 12:37:59 +00:00
3 changed files with 86 additions and 48 deletions

View file

@ -8,6 +8,7 @@
./bluetooth
./calibre
./comma
./delta
./dircolors
./direnv
./discord

View file

@ -0,0 +1,61 @@
{ config, pkgs, lib, ... }:
let
cfg = config.my.home.delta;
configFormat = pkgs.formats.gitIni { };
configPath = "${config.xdg.configHome}/delta/config";
in
{
options.my.home.delta = with lib; {
enable = my.mkDisableOption "delta configuration";
package = mkPackageOption pkgs "delta" { };
git = {
enable = my.mkDisableOption "git integration";
};
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."delta/config".source = configFormat.generate "delta-config" {
delta = {
features = "diff-highlight decorations";
# Less jarring style for `diff-highlight` emulation
diff-highlight = {
minus-style = "red";
minus-non-emph-style = "red";
minus-emph-style = "bold red 52";
plus-style = "green";
plus-non-emph-style = "green";
plus-emph-style = "bold green 22";
whitespace-error-style = "reverse red";
};
# Personal preference for easier reading
decorations = {
commit-style = "raw"; # Do not recolor meta information
keep-plus-minus-markers = true;
paging = "always";
};
};
};
programs.git = lib.mkIf cfg.git.enable {
includes = [
{
path = configPath;
}
];
delta = {
enable = true;
inherit (cfg) package;
};
};
};
}

View file

@ -42,34 +42,6 @@ in
lfs.enable = true;
delta = {
enable = true;
options = {
features = "diff-highlight decorations";
# Less jarring style for `diff-highlight` emulation
diff-highlight = {
minus-style = "red";
minus-non-emph-style = "red";
minus-emph-style = "bold red 52";
plus-style = "green";
plus-non-emph-style = "green";
plus-emph-style = "bold green 22";
whitespace-error-style = "reverse red";
};
# Personal preference for easier reading
decorations = {
commit-style = "raw"; # Do not recolor meta information
keep-plus-minus-markers = true;
paging = "always";
};
};
};
# There's more
extraConfig = {
# Makes it a bit more readable
@ -162,30 +134,34 @@ in
};
};
includes = [
includes = lib.mkMerge [
# Multiple identities
{
condition = "gitdir:~/git/EPITA/";
contents = {
user = {
name = "Bruno BELANYI";
email = mkMailAddress "bruno.belanyi" "epita.fr";
[
{
condition = "gitdir:~/git/EPITA/";
contents = {
user = {
name = "Bruno BELANYI";
email = mkMailAddress "bruno.belanyi" "epita.fr";
};
};
};
}
{
condition = "gitdir:~/git/work/";
contents = {
user = {
name = "Bruno BELANYI";
email = mkMailAddress "ambroisie" "google.com";
}
{
condition = "gitdir:~/git/work/";
contents = {
user = {
name = "Bruno BELANYI";
email = mkMailAddress "ambroisie" "google.com";
};
};
};
}
}
]
# Local configuration, not-versioned
{
path = "config.local";
}
(lib.mkAfter [
{
path = "config.local";
}
])
];
ignores =