From: Scott Worley Date: Sat, 30 May 2020 18:27:45 +0000 (-0700) Subject: Support multiple key files X-Git-Url: http://git.scottworley.com/auto-upgrade-with-pinch/commitdiff_plain/318cb8e22fa7dcdf691149b520b5d24428ee3cc9?ds=sidebyside Support multiple key files --- diff --git a/overlays/keyedgit.nix b/overlays/keyedgit.nix index 7688ace..6cce6fe 100644 --- a/overlays/keyedgit.nix +++ b/overlays/keyedgit.nix @@ -3,16 +3,22 @@ self: super: { keyedgit = keys: let + keyfile = if builtins.isList keys then + super.runCommand "keyfile" { } '' + cat ${super.lib.escapeShellArgs keys} > $out + '' + else + keys; homelessGPG = super.writeShellScript "homeless-gpg" '' export GNUPGHOME=$(mktemp -d) trap 'rm -r "$GNUPGHOME"' EXIT ${self.gnupg}/bin/gpg "$@" ''; - keyring = super.runCommand "keyedkeyring.gpg" {} '' - ${homelessGPG} --no-default-keyring --keyring=$out --import ${keys} + keyring = super.runCommand "keyedkeyring.gpg" { } '' + ${homelessGPG} --no-default-keyring --keyring=$out --import ${keyfile} ''; - keyids = super.runCommand "keyids" {} '' - ${homelessGPG} --no-default-keyring --with-colons --show-keys ${keys} | + keyids = super.runCommand "keyids" { } '' + ${homelessGPG} --no-default-keyring --with-colons --show-keys ${keyfile} | ${self.gawk}/bin/awk -F: '$1 == "pub" { print $5 }' > $out ''; keyedGPG = super.writeShellScript "keyed-gpg" ''