1 # Following the instructions at https://tribut.de/blog/git-commit-signatures-trusted-keys
6 keyfile = if builtins.isList keys then
7 super.runCommand "keyfile" { } ''
8 cat ${super.lib.escapeShellArgs keys} > $out
12 homelessGPG = super.writeShellScript "homeless-gpg" ''
13 export GNUPGHOME=$(mktemp -d)
14 trap 'rm -r "$GNUPGHOME"' EXIT
15 ${self.gnupg}/bin/gpg "$@"
17 keyring = super.runCommand "keyedkeyring.gpg" { } ''
18 ${homelessGPG} --no-default-keyring --keyring=$out --import ${keyfile}
20 keyids = super.runCommand "keyids" { } ''
21 ${homelessGPG} --no-default-keyring --with-colons --show-keys ${keyfile} |
22 ${self.gawk}/bin/awk -F: '$1 == "pub" { print $5 }' > $out
24 keyedGPG = super.writeShellScript "keyed-gpg" ''
27 trusted_key_args+=( --trusted-key "$keyid" )
29 ${homelessGPG} --no-default-keyring --keyring=${keyring} "''${trusted_key_args[@]}" "$@"
31 in super.symlinkJoin {
34 buildInputs = [ super.makeWrapper ];
36 wrapProgram "$out/bin/git" \
37 --add-flags '-c gpg.program=${keyedGPG}'