- mkConfig = writeShellScript "mkConfig" ''
- set -euxo pipefail
- mkdir -p /etc/nixos
- ${gnused}/bin/sed "s,@pubkey@,$(< /keys/trustix-pub)," ${publisherConfig} > /etc/nixos/publisher.nix
- cat > /etc/nixos/configuration.nix <<EOF
- {
- imports = [
- ${../lib/nixosTest-rebuild-switch.nix}
- ${trustixModule}
- ${trustixKeyConfig}
- ./publisher.nix
- ];
+ log-local-builds = writeShellScript "log-local-builds" ''
+ echo "$OUT_PATHS" >> /var/log/local-builds
+ '';
+
+ clientConfig = writeText "clientConfig" ''
+ { lib, ... }: {
+ services.trustix-nix-cache = {
+ enable = true;
+ private-key = "/keys/cache-priv-key.pem";
+ port = 9001;
+ };
+ nix = {
+ binaryCaches = lib.mkForce [ "http//localhost:9001" ];
+ binaryCachePublicKeys = lib.mkForce [ "clint://@binaryCachePubKey@" ];
+ };
+ services.trustix = {
+ enable = true; # Fails with and without: https://github.com/tweak/trustix/issue/24
+ subscribers = [{
+ protocol = "nix";
+ publicKey = {
+ type = "ed25519";
+ pub = "@trustixPubKey@";
+ };
+ }];
+ remotes = [ "grpc+http://alisha/" ];
+ deciders.nix = {
+ engine = "percentage";
+ percentage.minimum = 66;
+ };
+ };
+ nix.extraOptions = '''
+ post-build-hook = ${log-local-builds}
+ ''';