mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
c4edf93988
* maintainers: update email conni2461 * maintainers: add helsinki-jo * tree-wide: cleanup maintainership of helsinki-systems
56 lines
1.2 KiB
Nix
56 lines
1.2 KiB
Nix
{
|
|
system ? builtins.currentSystem
|
|
, pkgs ? import ../.. { inherit system; }
|
|
, package
|
|
}:
|
|
import ./make-test-python.nix ({ pkgs, lib, ... }: let
|
|
testPath = pkgs.hello;
|
|
in {
|
|
name = "varnish";
|
|
meta = {
|
|
maintainers = [ ];
|
|
};
|
|
|
|
nodes = {
|
|
varnish = { config, pkgs, ... }: {
|
|
services.nix-serve = {
|
|
enable = true;
|
|
};
|
|
|
|
services.varnish = {
|
|
inherit package;
|
|
enable = true;
|
|
http_address = "0.0.0.0:80";
|
|
config = ''
|
|
vcl 4.0;
|
|
|
|
backend nix-serve {
|
|
.host = "127.0.0.1";
|
|
.port = "${toString config.services.nix-serve.port}";
|
|
}
|
|
'';
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
system.extraDependencies = [ testPath ];
|
|
};
|
|
|
|
client = { lib, ... }: {
|
|
nix.settings = {
|
|
require-sigs = false;
|
|
substituters = lib.mkForce [ "http://varnish" ];
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
varnish.wait_for_open_port(80)
|
|
|
|
client.wait_until_succeeds("curl -f http://varnish/nix-cache-info");
|
|
|
|
client.wait_until_succeeds("nix-store -r ${testPath}");
|
|
client.succeed("${testPath}/bin/hello");
|
|
'';
|
|
})
|