2023-05-10 17:41:25 +01:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
|
2023-05-07 17:34:09 +01:00
|
|
|
{
|
|
|
|
name = "harmonia";
|
2023-05-10 17:41:25 +01:00
|
|
|
|
2023-05-07 17:34:09 +01:00
|
|
|
nodes = {
|
|
|
|
harmonia = {
|
|
|
|
services.harmonia = {
|
|
|
|
enable = true;
|
2024-08-17 11:51:53 +01:00
|
|
|
signKeyPaths = [(pkgs.writeText "cache-key" "cache.example.com-1:9FhO0w+7HjZrhvmzT1VlAZw4OSAlFGTgC24Seg3tmPl4gZBdwZClzTTHr9cVzJpwsRSYLTu7hEAQe3ljy92CWg==")];
|
2023-05-11 16:03:14 +01:00
|
|
|
settings.priority = 35;
|
2023-05-07 17:34:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 5000 ];
|
2023-05-10 17:41:25 +01:00
|
|
|
system.extraDependencies = [ pkgs.emptyFile ];
|
2023-11-18 12:45:20 +00:00
|
|
|
|
|
|
|
# check that extra-allowed-users is effective for harmonia
|
|
|
|
nix.settings.allowed-users = [];
|
2023-05-07 17:34:09 +01:00
|
|
|
};
|
|
|
|
|
2023-05-10 17:41:25 +01:00
|
|
|
client01 = {
|
2023-05-07 17:34:09 +01:00
|
|
|
nix.settings = {
|
|
|
|
substituters = lib.mkForce [ "http://harmonia:5000" ];
|
|
|
|
trusted-public-keys = lib.mkForce [ "cache.example.com-1:eIGQXcGQpc00x6/XFcyacLEUmC07u4RAEHt5Y8vdglo=" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-05-10 17:41:25 +01:00
|
|
|
testScript = { nodes, ... }: ''
|
2023-05-07 17:34:09 +01:00
|
|
|
start_all()
|
|
|
|
|
2023-05-10 17:41:25 +01:00
|
|
|
harmonia.wait_for_unit("harmonia.service")
|
2023-05-11 16:03:14 +01:00
|
|
|
|
|
|
|
client01.wait_until_succeeds("curl -f http://harmonia:5000/nix-cache-info | grep '${toString nodes.harmonia.services.harmonia.settings.priority}' >&2")
|
2023-05-10 17:41:25 +01:00
|
|
|
client01.succeed("curl -f http://harmonia:5000/version | grep '${nodes.harmonia.services.harmonia.package.version}' >&2")
|
2023-05-07 17:34:09 +01:00
|
|
|
|
|
|
|
client01.succeed("cat /etc/nix/nix.conf >&2")
|
2023-05-10 17:41:25 +01:00
|
|
|
client01.succeed("nix-store --realise ${pkgs.emptyFile} --store /root/other-store")
|
2023-05-07 17:34:09 +01:00
|
|
|
'';
|
2023-05-10 17:41:25 +01:00
|
|
|
}
|