summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSergey Mironov <grrwlf@gmail.com>2015-12-15 15:07:40 +0300
committerSergey Mironov <grrwlf@gmail.com>2016-01-27 22:47:09 +0300
commita4d977e01fe50c804013cc29dbd18f5f2f4efcfc (patch)
tree3d229f97a8e483717042d7cdc7d5dd2b0c50bc1e /nixos
parent421989fb5a5a3eb19a569cb0502a40572b3b1686 (diff)
downloadnixlib-a4d977e01fe50c804013cc29dbd18f5f2f4efcfc.tar
nixlib-a4d977e01fe50c804013cc29dbd18f5f2f4efcfc.tar.gz
nixlib-a4d977e01fe50c804013cc29dbd18f5f2f4efcfc.tar.bz2
nixlib-a4d977e01fe50c804013cc29dbd18f5f2f4efcfc.tar.lz
nixlib-a4d977e01fe50c804013cc29dbd18f5f2f4efcfc.tar.xz
nixlib-a4d977e01fe50c804013cc29dbd18f5f2f4efcfc.tar.zst
nixlib-a4d977e01fe50c804013cc29dbd18f5f2f4efcfc.zip
syncthing: support SOCKS5 proxying for relays
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/syncthing.nix21
1 files changed, 18 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix
index f5d5e1d25561..67b90516b996 100644
--- a/nixos/modules/services/networking/syncthing.nix
+++ b/nixos/modules/services/networking/syncthing.nix
@@ -33,6 +33,17 @@ in
         '';
       };
 
+      all_proxy = mkOption {
+        type = types.string;
+        default = "";
+        example = "socks5://address.com:1234";
+        description = ''
+          Overwrites all_proxy environment variable for the syncthing process to
+          the given value. This is normaly used to let relay client connect
+          through SOCKS5 proxy server.
+        '';
+      };
+
       dataDir = mkOption {
         default = "/var/lib/syncthing";
         description = ''
@@ -51,7 +62,6 @@ in
       };
 
 
-
     };
 
   };
@@ -66,8 +76,13 @@ in
         description = "Syncthing service";
         after = [ "network.target" ];
         wantedBy = [ "multi-user.target" ];
-        environment.STNORESTART = "yes";  # do not self-restart
-        environment.STNOUPGRADE = "yes";
+        environment = {
+          STNORESTART = "yes";  # do not self-restart
+          STNOUPGRADE = "yes";
+        } //
+        (config.networking.proxy.envVars) //
+        (if cfg.all_proxy != "" then { all_proxy = cfg.all_proxy; } else {});
+
         serviceConfig = {
           User = "${cfg.user}";
           PermissionsStartOnly = true;