git: Add textconv hook for age diff

pull/48/head
Simon Bruder 2021-02-08 19:19:18 +01:00
parent 78c9a2cab9
commit d6d2857322
Signed by: simon
GPG Key ID: 8D3C82F9F309F8EC
1 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,4 @@
{ config, ... }:
{ config, pkgs, ... }:
{
programs.git = {
enable = true;
@ -12,6 +12,18 @@
extraConfig = {
core.quotepath = "off";
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 = [