summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authormichael bishop <cleverca22@gmail.com>2017-06-25 20:17:20 -0300
committermichael bishop <cleverca22@gmail.com>2017-06-25 20:17:20 -0300
commitbb16bced36be4f61d19c7472ecb14949eb2d6914 (patch)
tree3b73ebd97cabda1acea863855560ab157e868750 /nixos
parentbd63daae03d6a3c014d0b5a526f2698c60f69e6f (diff)
downloadnixlib-bb16bced36be4f61d19c7472ecb14949eb2d6914.tar
nixlib-bb16bced36be4f61d19c7472ecb14949eb2d6914.tar.gz
nixlib-bb16bced36be4f61d19c7472ecb14949eb2d6914.tar.bz2
nixlib-bb16bced36be4f61d19c7472ecb14949eb2d6914.tar.lz
nixlib-bb16bced36be4f61d19c7472ecb14949eb2d6914.tar.xz
nixlib-bb16bced36be4f61d19c7472ecb14949eb2d6914.tar.zst
nixlib-bb16bced36be4f61d19c7472ecb14949eb2d6914.zip
toxvpn: 20161230 -> 2017-06-25
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/toxvpn.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/toxvpn.nix b/nixos/modules/services/networking/toxvpn.nix
index 911836fdee42..5e13402d7645 100644
--- a/nixos/modules/services/networking/toxvpn.nix
+++ b/nixos/modules/services/networking/toxvpn.nix
@@ -18,6 +18,13 @@ with lib;
         default     = 33445;
         description = "udp port for toxcore, port-forward to help with connectivity if you run many nodes behind one NAT";
       };
+
+      auto_add_peers = mkOption {
+        type        = types.listOf types.string;
+        default     = [];
+        example     = ''[ "toxid1" "toxid2" ]'';
+        description = "peers to automacally connect to on startup";
+      };
     };
   };
 
@@ -33,8 +40,13 @@ with lib;
         chown toxvpn /run/toxvpn
       '';
 
+      path = [ pkgs.toxvpn ];
+
+      script = ''
+        exec toxvpn -i ${config.services.toxvpn.localip} -l /run/toxvpn/control -u toxvpn -p ${toString config.services.toxvpn.port} ${lib.concatMapStringsSep " " (x: "-a ${x}") config.services.toxvpn.auto_add_peers}
+      '';
+
       serviceConfig = {
-        ExecStart = "${pkgs.toxvpn}/bin/toxvpn -i ${config.services.toxvpn.localip} -l /run/toxvpn/control -u toxvpn -p ${toString config.services.toxvpn.port}";
         KillMode  = "process";
         Restart   = "on-success";
         Type      = "notify";
@@ -43,6 +55,8 @@ with lib;
       restartIfChanged = false; # Likely to be used for remote admin
     };
 
+    environment.systemPackages = [ pkgs.toxvpn ];
+
     users.extraUsers = {
       toxvpn = {
         uid        = config.ids.uids.toxvpn;