Allow changing the diff tool used by `flake check`
enhancement
**Is your feature request related to a problem? Please describe.**
At the moment, treefmt-nix overwrites the default git config when running `nix flake check`. This is understandable given the possibility of sensitive options or those that require user-interaction, however it also resets the diff tool used.
**Describe the solution you'd like**
An option to set the diff tool to a custom program, such as [difftastic](https://github.com/Wilfred/difftastic) (pkgs.difftastic), would be useful.
**Describe alternatives you've considered**
I was able to patch this in manually, though obviously this isn't an ideal solution.
```patch
diff --git a/module-options.nix b/module-options.nix
index ad83f35..a19d9c7 100644
--- a/module-options.nix
+++ b/module-options.nix
@@ -315,6 +315,7 @@ in
pkgs.git
pkgs.git-lfs
config.build.wrapper
+ pkgs.difftastic
];
meta.description = "Check that the project tree is formatted";
}
@@ -334,6 +335,13 @@ in
email = nix@localhost
[init]
defaultBranch = main
+ [core]
+ conflictStyle = "diff3"
+ [diff]
+ external = "${pkgs.difftastic}/bin/difft "
+ tool = "difftastic"
+ [difftool "difftastic"]
+ cmd = "${pkgs.difftastic}/bin/difft $LOCAL $REMOTE"
EOF
git init --quiet
git add .
```
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
0 条评论