]> git.scottworley.com Git - auto-upgrade-with-pinch/commitdiff
Support multiple key files
authorScott Worley <scottworley@scottworley.com>
Sat, 30 May 2020 18:27:45 +0000 (11:27 -0700)
committerScott Worley <scottworley@scottworley.com>
Tue, 2 Jun 2020 07:22:30 +0000 (00:22 -0700)
overlays/keyedgit.nix

index 7688acefb3f0e9e2abdb49905801380f7d106755..6cce6fe2ffa9e681608e747a8f20679eebd0021f 100644 (file)
@@ -3,16 +3,22 @@
 self: super: {
   keyedgit = keys:
     let
 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 "$@"
       '';
       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" ''
           ${self.gawk}/bin/awk -F: '$1 == "pub" { print $5 }' > $out
       '';
       keyedGPG = super.writeShellScript "keyed-gpg" ''