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