about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorJoachim Fasting <joachifm@fastmail.fm>2016-10-24 20:32:43 +0200
committerJoachim Fasting <joachifm@fastmail.fm>2016-10-27 14:15:52 +0200
commit5fba586650464528d5be247f29eef3fc05950ba5 (patch)
tree34b5c04caa71af697a7734f62cfd12281ba51126 /nixos/modules/services
parentafe67f28a31484b4a33e8a2f9126ebc19d8a1809 (diff)
downloadnixlib-5fba586650464528d5be247f29eef3fc05950ba5.tar
nixlib-5fba586650464528d5be247f29eef3fc05950ba5.tar.gz
nixlib-5fba586650464528d5be247f29eef3fc05950ba5.tar.bz2
nixlib-5fba586650464528d5be247f29eef3fc05950ba5.tar.lz
nixlib-5fba586650464528d5be247f29eef3fc05950ba5.tar.xz
nixlib-5fba586650464528d5be247f29eef3fc05950ba5.tar.zst
nixlib-5fba586650464528d5be247f29eef3fc05950ba5.zip
cjdns service: better types
- types.string -> str, string is deprecated
- change type of confFile option to nullOr path, makes more sense
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/networking/cjdns.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/nixos/modules/services/networking/cjdns.nix b/nixos/modules/services/networking/cjdns.nix
index 8fad0cd07de1..c0955811e548 100644
--- a/nixos/modules/services/networking/cjdns.nix
+++ b/nixos/modules/services/networking/cjdns.nix
@@ -95,8 +95,8 @@ in
       };
 
       confFile = mkOption {
-        type = types.str;
-        default = "";
+        type = types.nullOr types.path;
+        default = null;
         example = "/etc/cjdroute.conf";
         description = ''
           Ignore all other cjdns options and load configuration from this file.
@@ -119,7 +119,7 @@ in
 
       admin = {
         bind = mkOption {
-          type = types.string;
+          type = types.str;
           default = "127.0.0.1:11234";
           description = ''
             Bind the administration port to this address and port.
@@ -129,7 +129,7 @@ in
 
       UDPInterface = {
         bind = mkOption {
-          type = types.string;
+          type = types.str;
           default = "";
           example = "192.168.1.32:43211";
           description = ''
@@ -154,6 +154,7 @@ in
 
       ETHInterface = {
         bind = mkOption {
+          type = types.str;
           default = "";
           example = "eth0";
           description =
@@ -212,7 +213,7 @@ in
       wantedBy = [ "multi-user.target" ];
       after = [ "network.target" ];
 
-      preStart = if cfg.confFile != "" then "" else ''
+      preStart = if cfg.confFile != null then "" else ''
         [ -e /etc/cjdns.keys ] && source /etc/cjdns.keys
 
         if [ -z "$CJDNS_PRIVATE_KEY" ]; then
@@ -234,7 +235,7 @@ in
       '';
 
       script = (
-        if cfg.confFile != "" then "${pkg}/bin/cjdroute < ${cfg.confFile}" else
+        if cfg.confFile != null then "${pkg}/bin/cjdroute < ${cfg.confFile}" else
           ''
             source /etc/cjdns.keys
             echo '${cjdrouteConf}' | sed \
@@ -253,7 +254,7 @@ in
     networking.extraHosts = "${cjdnsHosts}";
 
     assertions = [
-      { assertion = ( cfg.ETHInterface.bind != "" || cfg.UDPInterface.bind != "" || cfg.confFile != "" );
+      { assertion = ( cfg.ETHInterface.bind != "" || cfg.UDPInterface.bind != "" || cfg.confFile != null );
         message = "Neither cjdns.ETHInterface.bind nor cjdns.UDPInterface.bind defined.";
       }
       { assertion = config.networking.enableIPv6;