1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/modules/services/netbird.nix

36 lines
944 B
Nix
Raw Normal View History

2022-08-28 15:42:46 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.netbird;
in
{
options.services.netbird = {
2024-04-14 21:02:32 +00:00
enable = mkEnableOption "Netbird daemon";
2022-08-28 15:42:46 +00:00
package = mkOption {
type = types.package;
default = pkgs.netbird;
defaultText = literalExpression "pkgs.netbird";
2024-04-14 21:02:32 +00:00
description = "The package to use for netbird";
2022-08-28 15:42:46 +00:00
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
launchd.daemons.netbird = {
script = ''
mkdir -p /var/run/netbird /var/lib/netbird
exec ${cfg.package}/bin/netbird service run
'';
serviceConfig = {
EnvironmentVariables = {
NB_CONFIG = "/var/lib/netbird/config.json";
NB_LOG_FILE = "console";
};
KeepAlive = true;
RunAtLoad = true;
StandardOutPath = "/var/log/netbird.out.log";
StandardErrorPath = "/var/log/netbird.err.log";
};
};
};
}