Update zerotierone.nix

This commit is contained in:
Yonghan Ching 庄勇翰 2023-12-17 19:21:01 -06:00 committed by Emery Hemingway
parent 36791bab6a
commit b233faab82

View file

@ -4,6 +4,8 @@ with lib;
let
cfg = config.services.zerotierone;
conf = pkgs.writeText "zt-local.conf" (builtins.toJSON cfg.localConf);
localConfFilePath = "/var/lib/zerotier-one/local.conf";
in
{
options.services.zerotierone.enable = mkEnableOption (lib.mdDoc "ZeroTierOne");
@ -59,7 +61,11 @@ in
'' + (concatMapStrings (netId: ''
touch "/var/lib/zerotier-one/networks.d/${netId}.conf"
'') cfg.joinNetworks) + ''
ln -s ${conf} /var/lib/zerotier-one/local.conf
if [ -e "${localConfFilePath}" ]
then
rm ${localConfFilePath}
fi
ln -s ${conf} ${localConfFilePath}
'';
serviceConfig = {