nixos/tests: refactor gpg-keyring test utility
This commit is contained in:
parent
78df3591ec
commit
7e522a81ef
23
nixos/tests/common/gpg-keyring.nix
Normal file
23
nixos/tests/common/gpg-keyring.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
pkgs.runCommand "gpg-keyring" { nativeBuildInputs = [ pkgs.gnupg ]; } ''
|
||||
mkdir -p $out
|
||||
export GNUPGHOME=$out
|
||||
cat > foo <<EOF
|
||||
%echo Generating a basic OpenPGP key
|
||||
%no-protection
|
||||
Key-Type: DSA
|
||||
Key-Length: 1024
|
||||
Subkey-Type: ELG-E
|
||||
Subkey-Length: 1024
|
||||
Name-Real: Bob Foobar
|
||||
Name-Email: bob@foo.bar
|
||||
Expire-Date: 0
|
||||
# Do a commit here, so that we can later print "done"
|
||||
%commit
|
||||
%echo done
|
||||
EOF
|
||||
gpg --batch --generate-key foo
|
||||
rm $out/S.gpg-agent $out/S.gpg-agent.*
|
||||
gpg --export bob@foo.bar -a > $out/pubkey.gpg
|
||||
''
|
@ -1,26 +1,6 @@
|
||||
import ./make-test-python.nix ({pkgs, lib, ...}:
|
||||
let
|
||||
gpgKeyring = (pkgs.runCommand "gpg-keyring" { buildInputs = [ pkgs.gnupg ]; } ''
|
||||
mkdir -p $out
|
||||
export GNUPGHOME=$out
|
||||
cat > foo <<EOF
|
||||
%echo Generating a basic OpenPGP key
|
||||
%no-protection
|
||||
Key-Type: DSA
|
||||
Key-Length: 1024
|
||||
Subkey-Type: ELG-E
|
||||
Subkey-Length: 1024
|
||||
Name-Real: Bob Foobar
|
||||
Name-Email: bob@foo.bar
|
||||
Expire-Date: 0
|
||||
# Do a commit here, so that we can later print "done"
|
||||
%commit
|
||||
%echo done
|
||||
EOF
|
||||
gpg --batch --generate-key foo
|
||||
rm $out/S.gpg-agent $out/S.gpg-agent.*
|
||||
gpg --export bob@foo.bar -a > $out/pubkey.gpg
|
||||
'');
|
||||
gpgKeyring = import ./common/gpg-keyring.nix { inherit pkgs; };
|
||||
|
||||
nspawnImages = (pkgs.runCommand "localhost" { buildInputs = [ pkgs.coreutils pkgs.gnupg ]; } ''
|
||||
mkdir -p $out
|
||||
|
Loading…
Reference in New Issue
Block a user