1 import ./make-test-python.nix (
5 meta.maintainers = [ lib.maintainers.rizary ];
8 server = { pkgs, ... }: {
11 virtualHosts.default.root = "/var/www";
13 services.nar-serve = {
15 # Connect to the localhost nginx instead of the default
16 # https://cache.nixos.org
17 cacheURL = "http://localhost/";
19 environment.systemPackages = [
24 networking.firewall.allowedTCPPorts = [ 8383 ];
26 # virtualisation.diskSize = 2 * 1024;
32 # Create a fake cache with Nginx service the static files
34 "nix --experimental-features nix-command copy --to file:///var/www ${pkgs.hello}"
36 server.wait_for_unit("nginx.service")
37 server.wait_for_open_port(80)
39 # Check that nar-serve can return the content of the derivation
40 drvName = os.path.basename("${pkgs.hello}")
41 drvHash = drvName.split("-")[0]
42 server.wait_for_unit("nar-serve.service")
44 "curl -o hello -f http://localhost:8383/nix/store/{}/bin/hello".format(drvHash)