blob: 5842668479e0b5e0c27196e88536a58235b7c2f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{ pkgs, ... }:
let
port = "7745";
in
{
name = "homebox";
meta = {
inherit (pkgs.homebox.meta) maintainers;
};
nodes =
let
self = {
simple = {
services.homebox = {
enable = true;
settings.HBOX_WEB_PORT = port;
};
};
postgres = {
imports = [ self.simple ];
services.homebox.database.createLocally = true;
};
explicitPepper =
{
config,
lib,
...
}:
let
inherit (config.services.homebox)
user
group
;
in
{
systemd.tmpfiles.rules = [
"d /run/homebox 0700 ${user} ${group}"
"f /run/homebox/pepper 0400 ${user} ${group} - 0a7524fa7b4555ab793c177557b7b8db6619b47cc0574fb99716315e03b6ddf1d67961ee9bf36b19bef448ed3e530957"
];
imports = [ self.simple ];
services.homebox = {
secrets = {
HBOX_AUTH_API_KEY_PEPPER = "/run/homebox/pepper";
};
};
};
};
in
self;
testScript = ''
def test_homebox(node):
node.wait_for_unit("homebox.service")
node.wait_for_open_port(${port})
node.succeed("curl --fail -X GET 'http://localhost:${port}/'")
out = node.succeed("curl --fail 'http://localhost:${port}/api/v1/status'")
assert '"health":true' in out
test_homebox(simple)
simple.send_monitor_command("quit")
simple.wait_for_shutdown()
test_homebox(postgres)
test_homebox(explicitPepper)
'';
}
|