1{ pkgs, ... }:
2
3pkgs.runCommand "gpg-keyring" { nativeBuildInputs = [ pkgs.gnupg ]; } ''
4 mkdir -p $out
5 export GNUPGHOME=$out
6 cat > foo <<EOF
7 %echo Generating a basic OpenPGP key
8 %no-protection
9 Key-Type: EdDSA
10 Key-Curve: ed25519
11 Name-Real: Bob Foobar
12 Name-Email: bob@foo.bar
13 Expire-Date: 0
14 # Do a commit here, so that we can later print "done"
15 %commit
16 %echo done
17 EOF
18 gpg --batch --generate-key foo
19 rm $out/S.gpg-agent $out/S.gpg-agent.*
20 gpg --export bob@foo.bar -a > $out/pubkey.gpg
21''