flake.nix: Add basic check for opening the home page

This commit is contained in:
Tristan Daniël Maat 2022-10-03 02:40:19 +01:00
parent b76e61a55a
commit b88937af54
Signed by: tlater
GPG key ID: 49670FD774E43268
3 changed files with 49 additions and 0 deletions

View file

@ -64,5 +64,10 @@
]; ];
}; };
}; };
checks.${system} = import ./nix/checks {
inherit self system;
pkgs = nixpkgs.legacyPackages.${system};
};
}; };
} }

9
nix/checks/default.nix Normal file
View file

@ -0,0 +1,9 @@
{
pkgs,
self,
system,
}: let
callPackage = pkgs.lib.callPackageWith (pkgs // {inherit self;});
in {
openHomepage = callPackage ./open-homepage.nix {};
}

View file

@ -0,0 +1,35 @@
{
self,
nixosTest,
}:
nixosTest {
nodes = {
host = {
config,
lib,
pkgs,
...
}: {
imports = [self.nixosModules.default];
services.tlaternet-webserver = {
enable = true;
listen = {
addr = "0.0.0.0";
port = 8000;
};
};
networking.firewall.allowedTCPPorts = [8000];
};
client = {pkgs, ...}: {};
};
testScript = ''
start_all()
host.wait_for_unit("default.target")
client.succeed("curl --fail http://host:8000/ >&2")
'';
}