Update zerotierone.nix

This commit is contained in:
Yonghan Ching 庄勇翰 2023-12-17 17:58:47 -06:00 committed by Emery Hemingway
parent 097f2b6737
commit 0b357293e8

View File

@ -30,17 +30,17 @@ in
options.services.zerotierone.package = mkPackageOption pkgs "zerotierone" { }; options.services.zerotierone.package = mkPackageOption pkgs "zerotierone" { };
options.services.zerotierone.localConf = mkOption { options.services.zerotierone.localConf = mkOption {
default = { }; default = { };
description = mdDoc '' description = mdDoc ''
Configuration to be written to the zerotier JSON-based local.conf. Configuration to be written to the zerotier JSON-based local.conf.
The configuration will be symlinked to /var/lib/zerotier-one/local.conf at build time. The configuration will be symlinked to /var/lib/zerotier-one/local.conf at build time.
To understand the configuration format, refer to https://docs.zerotier.com/config/#local-configuration-options. To understand the configuration format, refer to https://docs.zerotier.com/config/#local-configuration-options.
''; '';
example = { example = {
settings.allowTcpFallbackRelay = false; settings.allowTcpFallbackRelay = false;
}; };
type = types.attrs; type = types.attrs;
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services.zerotierone = { systemd.services.zerotierone = {
@ -59,8 +59,9 @@ in
'' + (concatMapStrings (netId: '' '' + (concatMapStrings (netId: ''
touch "/var/lib/zerotier-one/networks.d/${netId}.conf" touch "/var/lib/zerotier-one/networks.d/${netId}.conf"
'') cfg.joinNetworks) + '' '') cfg.joinNetworks) + ''
ln -s ${conf} /var/lib/zerotier-one/local.conf ln -s ${conf} /var/lib/zerotier-one/local.conf
''; '';
serviceConfig = { serviceConfig = {
ExecStart = "${cfg.package}/bin/zerotier-one -p${toString cfg.port}"; ExecStart = "${cfg.package}/bin/zerotier-one -p${toString cfg.port}";
Restart = "always"; Restart = "always";