1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

nixos/netbird: init

This commit is contained in:
misuzu 2022-08-14 19:40:31 +03:00
parent fea7af99d9
commit 5fcdceb0b2
4 changed files with 75 additions and 0 deletions

View file

@ -205,6 +205,13 @@
<link linkend="opt-services.outline.enable">services.outline</link>. <link linkend="opt-services.outline.enable">services.outline</link>.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
<link xlink:href="https://netbird.io">netbird</link>, a zero
configuration VPN. Available as
<link xlink:href="options.html#opt-services.netbird.enable">services.netbird</link>.
</para>
</listitem>
<listitem> <listitem>
<para> <para>
<link xlink:href="https://github.com/aiberia/persistent-evdev">persistent-evdev</link>, <link xlink:href="https://github.com/aiberia/persistent-evdev">persistent-evdev</link>,

View file

@ -76,6 +76,9 @@ In addition to numerous new and upgraded packages, this release has the followin
- [Outline](https://www.getoutline.com/), a wiki and knowledge base similar to Notion. Available as [services.outline](#opt-services.outline.enable). - [Outline](https://www.getoutline.com/), a wiki and knowledge base similar to Notion. Available as [services.outline](#opt-services.outline.enable).
- [netbird](https://netbird.io), a zero configuration VPN.
Available as [services.netbird](options.html#opt-services.netbird.enable).
- [persistent-evdev](https://github.com/aiberia/persistent-evdev), a daemon to add virtual proxy devices that mirror a physical input device but persist even if the underlying hardware is hot-plugged. Available as [services.persistent-evdev](#opt-services.persistent-evdev.enable). - [persistent-evdev](https://github.com/aiberia/persistent-evdev), a daemon to add virtual proxy devices that mirror a physical input device but persist even if the underlying hardware is hot-plugged. Available as [services.persistent-evdev](#opt-services.persistent-evdev.enable).
- [schleuder](https://schleuder.org/), a mailing list manager with PGP support. Enable using [services.schleuder](#opt-services.schleuder.enable). - [schleuder](https://schleuder.org/), a mailing list manager with PGP support. Enable using [services.schleuder](#opt-services.schleuder.enable).

View file

@ -861,6 +861,7 @@
./services/networking/nbd.nix ./services/networking/nbd.nix
./services/networking/ndppd.nix ./services/networking/ndppd.nix
./services/networking/nebula.nix ./services/networking/nebula.nix
./services/networking/netbird.nix
./services/networking/networkmanager.nix ./services/networking/networkmanager.nix
./services/networking/nextdns.nix ./services/networking/nextdns.nix
./services/networking/nftables.nix ./services/networking/nftables.nix

View file

@ -0,0 +1,64 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.netbird;
kernel = config.boot.kernelPackages;
interfaceName = "wt0";
in {
meta.maintainers = with maintainers; [ misuzu ];
options.services.netbird = {
enable = mkEnableOption "Netbird daemon";
package = mkOption {
type = types.package;
default = pkgs.netbird;
defaultText = literalExpression "pkgs.netbird";
description = "The package to use for netbird";
};
};
config = mkIf cfg.enable {
boot.extraModulePackages = optional (versionOlder kernel.kernel.version "5.6") kernel.wireguard;
environment.systemPackages = [ cfg.package ];
networking.dhcpcd.denyInterfaces = [ interfaceName ];
systemd.network.networks."50-netbird" = mkIf config.networking.useNetworkd {
matchConfig = {
Name = interfaceName;
};
linkConfig = {
Unmanaged = true;
ActivationPolicy = "manual";
};
};
systemd.services.netbird = {
description = "A WireGuard-based mesh network that connects your devices into a single private network";
documentation = [ "https://netbird.io/docs/" ];
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
AmbientCapabilities = [ "CAP_NET_ADMIN" ];
DynamicUser = true;
Environment = [
"NB_CONFIG=/var/lib/netbird/config.json"
"NB_LOG_FILE=console"
];
ExecStart = "${cfg.package}/bin/netbird service run";
Restart = "always";
RuntimeDirectory = "netbird";
StateDirectory = "netbird";
WorkingDirectory = "/var/lib/netbird";
};
unitConfig = {
StartLimitInterval = 5;
StartLimitBurst = 10;
};
stopIfChanged = false;
};
};
}