summary refs log tree commit diff
path: root/nixos/modules/services/networking/cjdns.nix
diff options
context:
space:
mode:
authorEmery Hemingway <emery@vfemail.net>2015-04-15 11:02:05 -0400
committerEmery Hemingway <emery@vfemail.net>2015-04-25 09:40:44 -0400
commit34f1c39fe06d82936c492f62da1cd89b4d9e2553 (patch)
treef7356851b048059f9e9ba5c51f4b428ee4a1ed58 /nixos/modules/services/networking/cjdns.nix
parent35910404681a3812472d4463128b6adbeac9e0aa (diff)
downloadnixpkgs-34f1c39fe06d82936c492f62da1cd89b4d9e2553.tar
nixpkgs-34f1c39fe06d82936c492f62da1cd89b4d9e2553.tar.gz
nixpkgs-34f1c39fe06d82936c492f62da1cd89b4d9e2553.tar.bz2
nixpkgs-34f1c39fe06d82936c492f62da1cd89b4d9e2553.tar.lz
nixpkgs-34f1c39fe06d82936c492f62da1cd89b4d9e2553.tar.xz
nixpkgs-34f1c39fe06d82936c492f62da1cd89b4d9e2553.tar.zst
nixpkgs-34f1c39fe06d82936c492f62da1cd89b4d9e2553.zip
nixos: fix cjdns json config
filter extraneous attributes from config modules
Diffstat (limited to 'nixos/modules/services/networking/cjdns.nix')
-rw-r--r--nixos/modules/services/networking/cjdns.nix21
1 files changed, 13 insertions, 8 deletions
diff --git a/nixos/modules/services/networking/cjdns.nix b/nixos/modules/services/networking/cjdns.nix
index be0acb27324..f4063a3406f 100644
--- a/nixos/modules/services/networking/cjdns.nix
+++ b/nixos/modules/services/networking/cjdns.nix
@@ -44,6 +44,9 @@ let
       })
     else "";
 
+  parseModules = x:
+    x // { connectTo = mapAttrs (name: value: { inherit (value) password publicKey; }) x.connectTo; };
+
   # would be nice to  merge 'cfg' with a //,
   # but the json nesting is wacky.
   cjdrouteConf = builtins.toJSON ( {
@@ -53,8 +56,8 @@ let
     };
     authorizedPasswords = map (p: { password = p; }) cfg.authorizedPasswords;
     interfaces = {
-      ETHInterface = if (cfg.ETHInterface.bind != "") then [ cfg.ETHInterface ] else [ ];
-      UDPInterface = if (cfg.UDPInterface.bind != "") then [ cfg.UDPInterface ] else [ ];
+      ETHInterface = if (cfg.ETHInterface.bind != "") then [ (parseModules cfg.ETHInterface) ] else [ ];
+      UDPInterface = if (cfg.UDPInterface.bind != "") then [ (parseModules cfg.UDPInterface) ] else [ ];
     };
 
     privateKey = "@CJDNS_PRIVATE_KEY@";
@@ -151,12 +154,14 @@ in
 
       ETHInterface = {
         bind = mkOption {
-        default = "";
-        example = "eth0";
-        description = ''
-          Bind to this device for native ethernet operation.
-        '';
-      };
+          default = "";
+          example = "eth0";
+          description =
+            ''
+              Bind to this device for native ethernet operation.
+              <literal>all</literal> is a pseudo-name which will try to connect to all devices.
+            '';
+        };
 
         beacon = mkOption {
           type = types.int;