1{ lib, ... }:
2
3{
4 name = "echoip";
5 meta.maintainers = with lib.maintainers; [ defelo ];
6
7 nodes.machine = {
8 services.echoip = {
9 enable = true;
10 virtualHost = "echoip.local";
11 };
12
13 networking.hosts = {
14 "127.0.0.1" = [ "echoip.local" ];
15 "::1" = [ "echoip.local" ];
16 };
17 };
18
19 testScript = ''
20 machine.wait_for_unit("echoip.service")
21 machine.wait_for_open_port(8080)
22
23 resp = machine.succeed("curl -4 http://echoip.local/ip")
24 assert resp.strip() == "127.0.0.1"
25 resp = machine.succeed("curl -6 http://echoip.local/ip")
26 assert resp.strip() == "::1"
27 '';
28}