nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ pkgs, lib, ... }:
2{
3 name = "netbird";
4
5 meta.maintainers = with pkgs.lib.maintainers; [
6 nazarewk
7 ];
8
9 nodes = {
10 clients =
11 { ... }:
12 {
13 services.netbird.enable = true;
14 services.netbird.clients.custom.port = 51819;
15 };
16 };
17
18 # TODO: confirm the whole solution is working end-to-end when netbird server is implemented
19 testScript = ''
20 start_all()
21 def did_start(node, name, interval=0.5, timeout=10):
22 node.wait_for_unit(f"{name}.service")
23 node.wait_for_file(f"/var/run/{name}/sock")
24 # `netbird status` returns a full "Disconnected" status during initialization
25 # only after a while passes it starts returning "NeedsLogin" help message
26
27 start = time.time()
28 output = node.succeed(f"{name} status")
29 while "Disconnected" in output and (time.time() - start) < timeout:
30 time.sleep(interval)
31 output = node.succeed(f"{name} status")
32 assert "NeedsLogin" in output
33
34 did_start(clients, "netbird")
35 did_start(clients, "netbird-custom")
36 '';
37
38 /*
39 `netbird status` used to print `Daemon status: NeedsLogin`
40 https://github.com/netbirdio/netbird/blob/23a14737974e3849fa86408d136cc46db8a885d0/client/cmd/status.go#L154-L164
41 as the first line, but now it is just:
42
43 Daemon version: 0.26.3
44 CLI version: 0.26.3
45 Management: Disconnected
46 Signal: Disconnected
47 Relays: 0/0 Available
48 Nameservers: 0/0 Available
49 FQDN:
50 NetBird IP: N/A
51 Interface type: N/A
52 Quantum resistance: false
53 Routes: -
54 Peers count: 0/0 Connected
55 */
56}