1 import ./make-test-python.nix ({pkgs, lib, ...}:
3 gpgKeyring = (pkgs.runCommand "gpg-keyring" { buildInputs = [ pkgs.gnupg ]; } ''
7 %echo Generating a basic OpenPGP key
14 Name-Email: joe@foo.bar
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.*
22 gpg --export joe@foo.bar -a > $out/pubkey.gpg
25 nspawnImages = (pkgs.runCommand "localhost" { buildInputs = [ pkgs.coreutils pkgs.gnupg ]; } ''
28 dd if=/dev/urandom of=$out/testimage.raw bs=$((1024*1024+7)) count=5
29 sha256sum testimage.raw > SHA256SUMS
30 export GNUPGHOME="$(mktemp -d)"
31 cp -R ${gpgKeyring}/* $GNUPGHOME
32 gpg --batch --sign --detach-sign --output SHA256SUMS.gpg SHA256SUMS
35 name = "systemd-nspawn";
38 server = { pkgs, ... }: {
39 networking.firewall.allowedTCPPorts = [ 80 ];
42 virtualHosts."server".root = nspawnImages;
45 client = { pkgs, ... }: {
46 environment.etc."systemd/import-pubring.gpg".source = "${gpgKeyring}/pubkey.gpg";
53 server.wait_for_unit("nginx.service")
54 client.wait_for_unit("network-online.target")
55 client.succeed("machinectl pull-raw --verify=signature http://server/testimage.raw")
57 "cmp /var/lib/machines/testimage.raw ${nspawnImages}/testimage.raw"