1{ lib, ... }:
2
3let
4 password = "s3cRe!p4SsW0rD";
5in
6
7{
8 name = "lavalink";
9 meta.maintainers = with lib.maintainers; [ nanoyaki ];
10
11 nodes = {
12 machine = {
13 services.lavalink = {
14 enable = true;
15 port = 1234;
16 inherit password;
17 };
18 };
19 machine2 =
20 { pkgs, ... }:
21 {
22 services.lavalink = {
23 enable = true;
24 port = 1235;
25 environmentFile = "${pkgs.writeText "passwordEnvFile" ''
26 LAVALINK_SERVER_PASSWORD=${password}
27 ''}";
28 };
29 };
30 };
31
32 testScript = ''
33 start_all()
34
35 machine.wait_for_unit("lavalink.service")
36 machine.wait_for_open_port(1234)
37 machine.succeed("curl --header \"User-Id: 1204475253028429844\" --header \"Client-Name: shoukaku/4.1.1\" --header \"Authorization: ${password}\" http://localhost:1234/v4/info --fail -v")
38
39 machine2.wait_for_unit("lavalink.service")
40 machine2.wait_for_open_port(1235)
41 machine2.succeed("curl --header \"User-Id: 1204475253028429844\" --header \"Client-Name: shoukaku/4.1.1\" --header \"Authorization: ${password}\" http://localhost:1235/v4/info --fail -v")
42 '';
43}