1{ pkgs, ... }:
2let
3 port = "7745";
4in
5{
6 name = "homebox";
7 meta = with pkgs.lib.maintainers; {
8 maintainers = [ patrickdag ];
9 };
10 nodes =
11 let
12 self = {
13 simple = {
14 services.homebox = {
15 enable = true;
16 settings.HBOX_WEB_PORT = port;
17 };
18 };
19
20 postgres = {
21 imports = [ self.simple ];
22 services.homebox.database.createLocally = true;
23 };
24 };
25 in
26 self;
27 testScript = ''
28 def test_homebox(node):
29 node.wait_for_unit("homebox.service")
30 node.wait_for_open_port(${port})
31
32 node.succeed("curl --fail -X GET 'http://localhost:${port}/'")
33 out = node.succeed("curl --fail 'http://localhost:${port}/api/v1/status'")
34 assert '"health":true' in out
35
36 test_homebox(simple)
37 simple.send_monitor_command("quit")
38 simple.wait_for_shutdown()
39 test_homebox(postgres)
40 '';
41}