diff --git a/nix/checks/open-homepage.nix b/nix/checks/open-homepage.nix index dfecde6..dba360e 100644 --- a/nix/checks/open-homepage.nix +++ b/nix/checks/open-homepage.nix @@ -4,38 +4,32 @@ }: nixosTest { nodes = { - # Host with just the default configuration - defaults = { - imports = [self.nixosModules.default]; - services.tlaternet-webserver.enable = true; - }; - host = { + config, + lib, + pkgs, + ... + }: { imports = [self.nixosModules.default]; services.tlaternet-webserver = { enable = true; listen = { addr = "0.0.0.0"; - port = 8080; + port = 8000; }; }; - networking.firewall.allowedTCPPorts = [8080]; + networking.firewall.allowedTCPPorts = [8000]; }; - client = {}; + client = {pkgs, ...}: {}; }; testScript = '' start_all() - # Assert that the defaults work - defaults.wait_for_unit("tlaternet-webserver.service") - defaults.succeed("curl --fail http://localhost:8000 >&2") - - # Assert that we can listen on a public interface - host.wait_for_unit("tlaternet-webserver.service") - client.succeed("curl --fail http://host:8080 >&2") + host.wait_for_unit("default.target") + client.succeed("curl --fail http://host:8000/ >&2") ''; } diff --git a/nix/module.nix b/nix/module.nix index 6515c54..255e15c 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -16,17 +16,21 @@ in { options = { services.tlaternet-webserver = { enable = mkEnableOption "tlaternet web server"; - listen = { - addr = mkOption { - type = str; - description = "IP address."; - default = "127.0.0.1"; - }; + listen = mkOption { + type = submodule { + options = { + addr = mkOption { + type = str; + description = "IP address."; + default = "127.0.0.1"; + }; - port = mkOption { - type = int; - description = "Port number."; - default = 8000; + port = mkOption { + type = int; + description = "Port number."; + default = 8000; + }; + }; }; }; };