From d6d2857322edae3940e5e8bf09ae6349d5b6186e Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Mon, 8 Feb 2021 19:19:18 +0100 Subject: [PATCH] git: Add textconv hook for age diff --- users/simon/modules/git.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/users/simon/modules/git.nix b/users/simon/modules/git.nix index 0bc582c..a697356 100644 --- a/users/simon/modules/git.nix +++ b/users/simon/modules/git.nix @@ -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, + # rage’s error message will be displayed instead of the file’s + # contents. + textconv = toString (pkgs.writeShellScript "git-age-textconv" '' + ${pkgs.rage}/bin/rage -d -i ${config.xdg.configHome}/age/keys.txt "$@" 2>&1 || true + ''); + }; + }; }; ignores = [