2025-05-24 23:40:23 +08:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
{
|
|
|
|
name = "netbird";
|
2022-08-14 19:59:15 +03:00
|
|
|
|
2025-05-24 23:40:23 +08:00
|
|
|
meta.maintainers = with pkgs.lib.maintainers; [
|
|
|
|
nazarewk
|
|
|
|
];
|
2022-08-14 19:59:15 +03:00
|
|
|
|
2025-05-24 23:40:23 +08:00
|
|
|
nodes = {
|
|
|
|
clients =
|
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
services.netbird.enable = true;
|
|
|
|
services.netbird.clients.custom.port = 51819;
|
|
|
|
};
|
|
|
|
};
|
2022-08-14 19:59:15 +03:00
|
|
|
|
2025-05-24 23:40:23 +08:00
|
|
|
# TODO: confirm the whole solution is working end-to-end when netbird server is implemented
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
2025-06-26 11:52:37 +02:00
|
|
|
def did_start(node, name, interval=0.5, timeout=10):
|
2025-05-24 23:40:23 +08:00
|
|
|
node.wait_for_unit(f"{name}.service")
|
|
|
|
node.wait_for_file(f"/var/run/{name}/sock")
|
2025-06-26 11:52:37 +02:00
|
|
|
# `netbird status` returns a full "Disconnected" status during initialization
|
|
|
|
# only after a while passes it starts returning "NeedsLogin" help message
|
2025-01-09 15:42:19 +01:00
|
|
|
|
2025-06-26 11:52:37 +02:00
|
|
|
start = time.time()
|
|
|
|
output = node.succeed(f"{name} status")
|
|
|
|
while "Disconnected" in output and (time.time() - start) < timeout:
|
|
|
|
time.sleep(interval)
|
|
|
|
output = node.succeed(f"{name} status")
|
|
|
|
assert "NeedsLogin" in output
|
2025-01-09 15:42:19 +01:00
|
|
|
|
2025-05-24 23:40:23 +08:00
|
|
|
did_start(clients, "netbird")
|
|
|
|
did_start(clients, "netbird-custom")
|
|
|
|
'';
|
2025-01-09 15:42:19 +01:00
|
|
|
|
2025-05-24 23:40:23 +08:00
|
|
|
/*
|
|
|
|
`netbird status` used to print `Daemon status: NeedsLogin`
|
|
|
|
https://github.com/netbirdio/netbird/blob/23a14737974e3849fa86408d136cc46db8a885d0/client/cmd/status.go#L154-L164
|
|
|
|
as the first line, but now it is just:
|
2025-01-09 15:42:19 +01:00
|
|
|
|
2025-05-24 23:40:23 +08:00
|
|
|
Daemon version: 0.26.3
|
|
|
|
CLI version: 0.26.3
|
|
|
|
Management: Disconnected
|
|
|
|
Signal: Disconnected
|
|
|
|
Relays: 0/0 Available
|
|
|
|
Nameservers: 0/0 Available
|
|
|
|
FQDN:
|
|
|
|
NetBird IP: N/A
|
|
|
|
Interface type: N/A
|
|
|
|
Quantum resistance: false
|
|
|
|
Routes: -
|
|
|
|
Peers count: 0/0 Connected
|
|
|
|
*/
|
|
|
|
}
|