12 inherit (lib.types) str;
14 cfg = config.services.netbird.server;
19 maintainers = with lib.maintainers; [patrickdag];
23 # Import the separate components
31 options.services.netbird.server = {
32 enable = mkEnableOption "Netbird Server stack, comprising the dashboard, management API and signal service";
34 enableNginx = mkEnableOption "Nginx reverse-proxy for the netbird server services";
38 description = "The domain under which the netbird server runs.";
42 config = mkIf cfg.enable {
43 services.netbird.server = {
45 domain = mkDefault cfg.domain;
46 enable = mkDefault cfg.enable;
47 enableNginx = mkDefault cfg.enableNginx;
49 managementServer = "https://${cfg.domain}";
54 domain = mkDefault cfg.domain;
55 enable = mkDefault cfg.enable;
56 enableNginx = mkDefault cfg.enableNginx;
58 // (optionalAttrs cfg.coturn.enable rec {
59 turnDomain = cfg.domain;
60 turnPort = config.services.coturn.tls-listening-port;
61 # We cannot merge a list of attrsets so we have to redefine the whole list
63 TURNConfig.Turns = mkDefault [
66 URI = "turn:${turnDomain}:${builtins.toString turnPort}";
69 if (cfg.coturn.password != null)
70 then cfg.coturn.password
71 else {_secret = cfg.coturn.passwordFile;};
78 domain = mkDefault cfg.domain;
79 enable = mkDefault cfg.enable;
80 enableNginx = mkDefault cfg.enableNginx;
84 domain = mkDefault cfg.domain;