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,7 +16,9 @@ in {
options = { options = {
services.tlaternet-webserver = { services.tlaternet-webserver = {
enable = mkEnableOption "tlaternet web server"; enable = mkEnableOption "tlaternet web server";
listen = { listen = mkOption {
type = submodule {
options = {
addr = mkOption { addr = mkOption {
type = str; type = str;
description = "IP address."; description = "IP address.";
@ -31,6 +33,8 @@ in {
}; };
}; };
}; };
};
};
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.tlaternet-webserver = { systemd.services.tlaternet-webserver = {