git: Add textconv hook for age diff

This commit is contained in:
Simon Bruder 2021-02-08 19:19:18 +01:00
parent 78c9a2cab9
commit d6d2857322
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -1,4 +1,4 @@
{ config, ... }: { config, pkgs, ... }:
{ {
programs.git = { programs.git = {
enable = true; enable = true;
@ -12,6 +12,18 @@
extraConfig = { extraConfig = {
core.quotepath = "off"; core.quotepath = "off";
pull.ff = "only"; pull.ff = "only";
diff = {
age = {
# This uses the de facto default key location with no ability to
# specify another key.
# If decryption fails (e.g. due to a lack of the right private key,
# rages error message will be displayed instead of the files
# contents.
textconv = toString (pkgs.writeShellScript "git-age-textconv" ''
${pkgs.rage}/bin/rage -d -i ${config.xdg.configHome}/age/keys.txt "$@" 2>&1 || true
'');
};
};
}; };
ignores = [ ignores = [