}
'';
+ log-local-builds = writeShellScript "log-local-builds" ''
+ echo "$OUT_PATHS" >> /var/log/local-builds
+ '';
+
clientConfig = writeText "clientConfig" ''
{ lib, ... }: {
services.trustix-nix-cache = {
percentage.minimum = 66;
};
};
-
+ nix.extraOptions = '''
+ post-build-hook = ${log-local-builds}
+ ''';
}
'';
};
testScript = ''
from os import getenv
+ from threading import Thread
alisha.wait_for_file("/keys/trustix-pub")
alisha.copy_from_vm("/keys/trustix-pub")
clint.copy_from_host(getenv("out") + "/trustix-pub", "/keys/alisha-signing-pub")
+ clint.wait_for_file("/keys/cache-priv-key.pem")
+ clint_thread = Thread(
+ target=lambda: clint.succeed(
+ "${
+ mkConfig {
+ config = clientConfig;
+ trustixPubKeyPath = "/keys/alisha-signing-pub";
+ binaryCachePubKeyPath = "/keys/cache-priv-key.pem";
+ }
+ }",
+ "nixos-rebuild switch --show-trace",
+ )
+ )
+ clint_thread.start()
+
alisha.succeed(
"${
mkConfig {
)
alisha.succeed("nix-build '<nixpkgs>' -A hello")
- clint.wait_for_file("/keys/cache-priv-key.pem")
- clint.succeed(
- "${
- mkConfig {
- config = clientConfig;
- trustixPubKeyPath = "/keys/alisha-signing-pub";
- binaryCachePubKeyPath = "/keys/cache-priv-key.pem";
- }
- }",
- "nixos-rebuild switch --show-trace",
- )
+ clint_thread.join()
clint.succeed("nix-build '<nixpkgs>' -A hello")
+ clint.fail("grep hello /var/log/local-builds")
'';
}