Compare commits

..

No commits in common. "5d037f9122e68aaa5db62d04810bf0c5e1e4325e" and "6c29bc5db001e75f5ca06fec726369b87d007a03" have entirely different histories.

2 changed files with 24 additions and 26 deletions

View file

@ -4,38 +4,32 @@
}: }:
nixosTest { nixosTest {
nodes = { nodes = {
# Host with just the default configuration
defaults = {
imports = [self.nixosModules.default];
services.tlaternet-webserver.enable = true;
};
host = { host = {
config,
lib,
pkgs,
...
}: {
imports = [self.nixosModules.default]; imports = [self.nixosModules.default];
services.tlaternet-webserver = { services.tlaternet-webserver = {
enable = true; enable = true;
listen = { listen = {
addr = "0.0.0.0"; addr = "0.0.0.0";
port = 8080; port = 8000;
}; };
}; };
networking.firewall.allowedTCPPorts = [8080]; networking.firewall.allowedTCPPorts = [8000];
}; };
client = {}; client = {pkgs, ...}: {};
}; };
testScript = '' testScript = ''
start_all() start_all()
# Assert that the defaults work host.wait_for_unit("default.target")
defaults.wait_for_unit("tlaternet-webserver.service") client.succeed("curl --fail http://host:8000/ >&2")
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")
''; '';
} }

View file

@ -16,17 +16,21 @@ in {
options = { options = {
services.tlaternet-webserver = { services.tlaternet-webserver = {
enable = mkEnableOption "tlaternet web server"; enable = mkEnableOption "tlaternet web server";
listen = { listen = mkOption {
addr = mkOption { type = submodule {
type = str; options = {
description = "IP address."; addr = mkOption {
default = "127.0.0.1"; type = str;
}; description = "IP address.";
default = "127.0.0.1";
};
port = mkOption { port = mkOption {
type = int; type = int;
description = "Port number."; description = "Port number.";
default = 8000; default = 8000;
};
};
}; };
}; };
}; };