home: git: extract 'delta' configuration
All checks were successful
ci/woodpecker/push/check Pipeline was successful
All checks were successful
ci/woodpecker/push/check Pipeline was successful
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.
This commit is contained in:
parent
ec1c94676a
commit
946eab9ec0
3 changed files with 62 additions and 28 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
./bluetooth
|
./bluetooth
|
||||||
./calibre
|
./calibre
|
||||||
./comma
|
./comma
|
||||||
|
./delta
|
||||||
./dircolors
|
./dircolors
|
||||||
./direnv
|
./direnv
|
||||||
./discord
|
./discord
|
||||||
|
|
|
||||||
61
modules/home/delta/default.nix
Normal file
61
modules/home/delta/default.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.my.home.delta;
|
||||||
|
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 {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
# For its configuration
|
||||||
|
assertion = cfg.enable -> cfg.git.enable;
|
||||||
|
message = ''
|
||||||
|
`config.my.home.delta` must enable `config.my.home.delta.git` to be
|
||||||
|
properly configured.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
programs.git = lib.mkIf cfg.git.enable {
|
||||||
|
delta = {
|
||||||
|
enable = true;
|
||||||
|
inherit (cfg) package;
|
||||||
|
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -42,34 +42,6 @@ in
|
||||||
|
|
||||||
lfs.enable = true;
|
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
|
# There's more
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
# Makes it a bit more readable
|
# Makes it a bit more readable
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue