1{ pkgs, lib, ... }:
2
3{
4 name = "harmonia";
5
6 nodes = {
7 harmonia = {
8 services.harmonia = {
9 enable = true;
10 signKeyPath = pkgs.writeText "cache-key" "cache.example.com-1:9FhO0w+7HjZrhvmzT1VlAZw4OSAlFGTgC24Seg3tmPl4gZBdwZClzTTHr9cVzJpwsRSYLTu7hEAQe3ljy92CWg==";
11 settings.priority = 35;
12 };
13
14 networking.firewall.allowedTCPPorts = [ 5000 ];
15 system.extraDependencies = [ pkgs.emptyFile ];
16 };
17
18 client01 = {
19 nix.settings = {
20 substituters = lib.mkForce [ "http://harmonia:5000" ];
21 trusted-public-keys = lib.mkForce [ "cache.example.com-1:eIGQXcGQpc00x6/XFcyacLEUmC07u4RAEHt5Y8vdglo=" ];
22 };
23 };
24 };
25
26 testScript = { nodes, ... }: ''
27 start_all()
28
29 harmonia.wait_for_unit("harmonia.service")
30
31 client01.wait_until_succeeds("curl -f http://harmonia:5000/nix-cache-info | grep '${toString nodes.harmonia.services.harmonia.settings.priority}' >&2")
32 client01.succeed("curl -f http://harmonia:5000/version | grep '${nodes.harmonia.services.harmonia.package.version}' >&2")
33
34 client01.succeed("cat /etc/nix/nix.conf >&2")
35 client01.succeed("nix-store --realise ${pkgs.emptyFile} --store /root/other-store")
36 '';
37}