about summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2024-06-21 15:32:05 +0200
committerGitHub <noreply@github.com>2024-06-21 15:32:05 +0200
commit9f180c5438b25fc0bd6ed0baa6e9518c0c453896 (patch)
treed0b4030162a387109bd3555c2a23dd208b2e7af2 /nixos/modules/services/networking
parentc80fa3159a02c011c649703814ade3015b94890f (diff)
parent09ead1f6ebeacc83cef72a059b1de3756cca7ac0 (diff)
Merge pull request #280517 from Mic92/zerotierone
nixos/zerotierone: make localConf mergeable
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/zerotierone.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/zerotierone.nix b/nixos/modules/services/networking/zerotierone.nix
index 86c1efc629a98..68c04118fdd58 100644
--- a/nixos/modules/services/networking/zerotierone.nix
+++ b/nixos/modules/services/networking/zerotierone.nix
@@ -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}