nix-config/modules/netbird-client.nix
Renovate Bot 2931b74afd Update netbird (#22)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [netbirdio/dashboard](https://github.com/netbirdio/dashboard) | patch | `v2.90.3` → `v2.90.4` |
| netbirdio/netbird | patch | `v0.74.1-rootless` → `v0.74.6-rootless` |
| netbirdio/netbird-server | patch | `0.74.1` → `0.74.6` |
| netbirdio/reverse-proxy | patch | `0.74.1` → `0.74.6` |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/12) for more information.

---

### Release Notes

<details>
<summary>netbirdio/dashboard (netbirdio/dashboard)</summary>

### [`v2.90.4`](https://github.com/netbirdio/dashboard/releases/tag/v2.90.4)

[Compare Source](https://github.com/netbirdio/dashboard/compare/v2.90.3...v2.90.4)

#### What's Changed

- Fix Skip TLS doc link and model pricing format by [@&#8203;braginini](https://github.com/braginini) in [#&#8203;699](https://github.com/netbirdio/dashboard/pull/699)
- aggregated traffic events by [@&#8203;pascal-fischer](https://github.com/pascal-fischer) in [#&#8203;693](https://github.com/netbirdio/dashboard/pull/693)
- Show management API request id in error notifications by [@&#8203;mlsmaycon](https://github.com/mlsmaycon) in [#&#8203;698](https://github.com/netbirdio/dashboard/pull/698)
- Improve RDP connection error handling and retry flow by [@&#8203;lixmal](https://github.com/lixmal) in [#&#8203;701](https://github.com/netbirdio/dashboard/pull/701)
- Default billing to EUR, preserve USD for active subscribers by [@&#8203;SunsetDrifter](https://github.com/SunsetDrifter) in [#&#8203;702](https://github.com/netbirdio/dashboard/pull/702)
- Revert using tenants own currency and instead use MSP currency by [@&#8203;heisbrot](https://github.com/heisbrot) in [#&#8203;703](https://github.com/netbirdio/dashboard/pull/703)
- new traffic filters by [@&#8203;pascal-fischer](https://github.com/pascal-fischer) in [#&#8203;704](https://github.com/netbirdio/dashboard/pull/704)
- Remove experimental flag from lazy connections by [@&#8203;heisbrot](https://github.com/heisbrot) in [#&#8203;706](https://github.com/netbirdio/dashboard/pull/706)
- \[reverse proxy] Feature/cluster one click deploy by [@&#8203;mlsmaycon](https://github.com/mlsmaycon) in [#&#8203;707](https://github.com/netbirdio/dashboard/pull/707)
- Focus dashboard on Agent Network for netbird.ai signups by [@&#8203;mlsmaycon](https://github.com/mlsmaycon) in [#&#8203;708](https://github.com/netbirdio/dashboard/pull/708)
- Make Agent Network menu available via dashboard\_features by [@&#8203;mlsmaycon](https://github.com/mlsmaycon) in [#&#8203;709](https://github.com/netbirdio/dashboard/pull/709)

#### New Contributors

- [@&#8203;SunsetDrifter](https://github.com/SunsetDrifter) made their first contribution in [#&#8203;702](https://github.com/netbirdio/dashboard/pull/702)

**Full Changelog**: <https://github.com/netbirdio/dashboard/compare/v2.90.3...v2.90.4>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNTAuMSIsInVwZGF0ZWRJblZlciI6IjQzLjE1MC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: #22
Co-authored-by: Renovate Bot <renovate@jfreudenberger.de>
Co-committed-by: Renovate Bot <renovate@jfreudenberger.de>
2026-07-17 01:04:03 +02:00

102 lines
2.8 KiB
Nix

{
pkgs,
utils,
config,
lib,
...
}:
let
cfg = config.services.netbird-client;
clientConfiguration = lib.types.submodule {
options = {
setupKey = lib.mkOption {
description = "Setup Key for this client";
type = lib.types.nullOr lib.types.str;
default = null;
};
};
};
in {
options.services.netbird-client = {
enable = lib.mkEnableOption "Netbird client, with possiblities for host connection and for docker based connection.";
managementUrl = lib.mkOption {
description = "Management URL of netbird server.";
type = lib.types.str;
};
host = lib.mkOption {
description = "Configuration for host connection";
type = clientConfiguration;
};
docker = lib.mkOption {
description = "Configuration for docker connection";
type = clientConfiguration;
};
dockerSubnet = lib.mkOption {
description = "Second part of ipv4 subnet";
type = lib.types.str;
default = "20";
};
};
config = lib.mkIf cfg.enable {
services.netbird = lib.mkIf (cfg.host.setupKey != null) {
useRoutingFeatures = "both";
clients.wt0 = {
hardened = false;
login = {
enable = true;
setupKeyFile = (pkgs.writeText "setupKey" cfg.host.setupKey).outPath;
};
port = 51820;
environment = {
NB_MANAGEMENT_URL = cfg.managementUrl;
};
};
};
services.resolved.enable = lib.mkIf (cfg.host.setupKey != null) true;
virtualisation.oci-containers.containers = lib.mkIf (cfg.docker.setupKey != null) {
netbird = {
image = "netbirdio/netbird:v0.74.6-rootless@sha256:21516faecb7ddd9d6207ebcb1196da57bfe6a6fb8cd4fc9693482bf5a4917bcf";
autoStart = true;
hostname = "${config.networking.hostName}-docker";
networks = [
"webproxy"
];
environment = {
NB_MANAGEMENT_URL = cfg.managementUrl;
PEER_NAME = "${config.networking.hostName}-docker";
NB_SETUP_KEY = cfg.docker.setupKey;
};
extraOptions = [
''--mount=type=volume,source=netbird_client_data,target=/var/lib/netbird,volume-driver=local''
];
};
};
systemd.services."docker-netbird" = lib.mkIf (cfg.docker.setupKey != null) {
after = [
"docker-network-webproxy.service"
];
requires = [
"docker-network-webproxy.service"
];
};
systemd.services."docker-network-webproxy" = lib.mkIf (cfg.docker.setupKey != null) {
path = [ pkgs.docker_29 ];
serviceConfig = {
Type = "oneshot";
};
script = ''
docker network inspect webproxy || docker network create webproxy --ipv4 --ipv6 --subnet=172.${cfg.dockerSubnet}.0.0/16 --gateway=172.${cfg.dockerSubnet}.0.1
'';
};
};
}