1 import ./make-test-python.nix ({ lib, pkgs, ... }:
3 gpgKeyring = (pkgs.runCommand "gpg-keyring" { buildInputs = [ pkgs.gnupg ]; } ''
7 %echo Generating a basic OpenPGP key
13 Name-Real: Foo Example
14 Name-Email: foo@example.org
16 # Do a commit here, so that we can later print "done"
20 gpg --batch --generate-key foo
21 rm $out/S.gpg-agent $out/S.gpg-agent.*
25 meta.maintainers = with lib.maintainers; [ etu ];
27 nodes.machine = { ... }: {
29 environment.systemPackages = [ pkgs.gnupg ];
31 services.hockeypuck.enable = true;
33 services.postgresql = {
35 ensureDatabases = [ "hockeypuck" ];
38 ensurePermissions."DATABASE hockeypuck" = "ALL PRIVILEGES";
44 machine.wait_for_unit("hockeypuck.service")
45 machine.wait_for_open_port(11371)
47 response = machine.succeed("curl -vvv -s http://127.0.0.1:11371/")
49 assert "<title>OpenPGP Keyserver</title>" in response, "HTML title not found"
52 machine.succeed("cp -R ${gpgKeyring} /tmp/GNUPGHOME")
54 # Extract our GPG key id
55 keyId = machine.succeed("GNUPGHOME=/tmp/GNUPGHOME gpg --list-keys | grep dsa1024 --after-context=1 | grep -v dsa1024").strip()
57 # Send the key to our local keyserver
58 machine.succeed("GNUPGHOME=/tmp/GNUPGHOME gpg --keyserver hkp://127.0.0.1:11371 --send-keys " + keyId)
60 # Recieve the key from our local keyserver to a separate directory
61 machine.succeed("GNUPGHOME=$(mktemp -d) gpg --keyserver hkp://127.0.0.1:11371 --recv-keys " + keyId)