mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
Merge pull request #280517 from Mic92/zerotierone
nixos/zerotierone: make localConf mergeable
This commit is contained in:
commit
9f180c5438
@ -4,7 +4,9 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.zerotierone;
|
||||
localConfFile = pkgs.writeText "zt-local.conf" (builtins.toJSON cfg.localConf);
|
||||
|
||||
settingsFormat = pkgs.formats.json {};
|
||||
localConfFile = settingsFormat.generate "zt-local.conf" cfg.localConf;
|
||||
localConfFilePath = "/var/lib/zerotier-one/local.conf";
|
||||
in
|
||||
{
|
||||
@ -41,7 +43,7 @@ in
|
||||
example = {
|
||||
settings.allowTcpFallbackRelay = false;
|
||||
};
|
||||
type = types.nullOr types.attrs;
|
||||
type = settingsFormat.type;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@ -60,7 +62,7 @@ in
|
||||
chown -R root:root /var/lib/zerotier-one
|
||||
'' + (concatMapStrings (netId: ''
|
||||
touch "/var/lib/zerotier-one/networks.d/${netId}.conf"
|
||||
'') cfg.joinNetworks) + optionalString (cfg.localConf != null) ''
|
||||
'') cfg.joinNetworks) + optionalString (cfg.localConf != {}) ''
|
||||
if [ -L "${localConfFilePath}" ]
|
||||
then
|
||||
rm ${localConfFilePath}
|
||||
|
Loading…
Reference in New Issue
Block a user