1# Netbird {#module-services-netbird}
2
3## Quickstart {#module-services-netbird-quickstart}
4
5The absolute minimal configuration for the netbird daemon looks like this:
6
7```nix
8{
9 services.netbird.enable = true;
10}
11```
12
13This will set up a netbird service listening on the port `51820` associated to the
14`wt0` interface.
15
16It is strictly equivalent to setting:
17
18```nix
19{
20 services.netbird.tunnels.wt0.stateDir = "netbird";
21}
22```
23
24The `enable` option is mainly kept for backward compatibility, as defining netbird
25tunnels through the `tunnels` option is more expressive.
26
27## Multiple connections setup {#module-services-netbird-multiple-connections}
28
29Using the `services.netbird.tunnels` option, it is also possible to define more than
30one netbird service running at the same time.
31
32The following configuration will start a netbird daemon using the interface `wt1` and
33the port 51830. Its configuration file will then be located at `/var/lib/netbird-wt1/config.json`.
34
35```nix
36{
37 services.netbird.tunnels = {
38 wt1 = {
39 port = 51830;
40 };
41 };
42}
43```
44
45To interact with it, you will need to specify the correct daemon address:
46
47```bash
48netbird --daemon-addr unix:///var/run/netbird-wt1/sock ...
49```
50
51The address will by default be `unix:///var/run/netbird-<name>`.
52
53It is also possible to overwrite default options passed to the service, for
54example:
55
56```nix
57{
58 services.netbird.tunnels.wt1.environment = {
59 NB_DAEMON_ADDR = "unix:///var/run/toto.sock";
60 };
61}
62```
63
64This will set the socket to interact with the netbird service to `/var/run/toto.sock`.