aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2020-07-20 10:03:40 -0500
committerGitHub <noreply@github.com>2020-07-20 17:03:40 +0200
commit4bd0ca2cd793b3f057d114bd6a3183419f52ca49 (patch)
tree317c94b585846fb978c09157e70a67ebb9d5cfee /modules
parent5c639ff68abf0f16f2e63fb3f8aca016d54c7d10 (diff)
git: configure delta through [delta] git section (#1371)
this breaks backwards compatibility (now accepts a dict instead of a list) so please update programs.git.delta.options accordingly.
Diffstat (limited to 'modules')
-rw-r--r--modules/programs/git.nix35
1 files changed, 23 insertions, 12 deletions
diff --git a/modules/programs/git.nix b/modules/programs/git.nix
index ec2402f11f8..a174fa0c4ee 100644
--- a/modules/programs/git.nix
+++ b/modules/programs/git.nix
@@ -225,11 +225,23 @@ in {
};
options = mkOption {
- type = types.listOf types.str;
- default = [ ];
- example = [ "--dark" ];
+ type = with types;
+ let
+ primitiveType = either str (either bool int);
+ sectionType = attrsOf primitiveType;
+ in attrsOf (either primitiveType sectionType);
+ default = { };
+ example = {
+ features = "decorations";
+ whitespace-error-style = "22 reverse";
+ decorations = {
+ commit-decoration-style = "bold yellow box ul";
+ file-style = "bold yellow ul";
+ file-decoration-style = "none";
+ };
+ };
description = ''
- Extra command line options given to delta.
+ Options to configure delta.
'';
};
};
@@ -329,14 +341,13 @@ in {
})
(mkIf cfg.delta.enable {
- programs.git.iniContent = let
- deltaArgs = [ "${pkgs.gitAndTools.delta}/bin/delta" ]
- ++ cfg.delta.options;
- in {
- core.pager = concatStringsSep " " deltaArgs;
- interactive.diffFilter =
- concatStringsSep " " (deltaArgs ++ [ "--color-only" ]);
- };
+ programs.git.iniContent =
+ let deltaCommand = "${pkgs.gitAndTools.delta}/bin/delta";
+ in {
+ core.pager = deltaCommand;
+ interactive.diffFilter = "${deltaCommand} --color-only";
+ delta = cfg.delta.options;
+ };
})
]);
}