summary refs log tree commit diff
path: root/nixos/modules/services/network-filesystems
diff options
context:
space:
mode:
authorSarah Brofeldt <sbrofeldt@gmail.com>2018-05-24 10:53:49 +0200
committerGitHub <noreply@github.com>2018-05-24 10:53:49 +0200
commite27a4502cb1e0fb4a618dae0f6eee390f037d089 (patch)
tree1c17bca4ab6ddb80b9a03f0603bd0b3eb1d3e789 /nixos/modules/services/network-filesystems
parent1c39035cad1bbcc7cf2a735ce8b81f74957fdab5 (diff)
parent2009c76a665435f706a27768d8dba69736ae1282 (diff)
downloadnixlib-e27a4502cb1e0fb4a618dae0f6eee390f037d089.tar
nixlib-e27a4502cb1e0fb4a618dae0f6eee390f037d089.tar.gz
nixlib-e27a4502cb1e0fb4a618dae0f6eee390f037d089.tar.bz2
nixlib-e27a4502cb1e0fb4a618dae0f6eee390f037d089.tar.lz
nixlib-e27a4502cb1e0fb4a618dae0f6eee390f037d089.tar.xz
nixlib-e27a4502cb1e0fb4a618dae0f6eee390f037d089.tar.zst
nixlib-e27a4502cb1e0fb4a618dae0f6eee390f037d089.zip
Merge pull request #40879 from seppeljordan/pr-ipfs-port-scanning
nixos/ipfs: Add option to disable local port scanning for ipfs daemon
Diffstat (limited to 'nixos/modules/services/network-filesystems')
-rw-r--r--nixos/modules/services/network-filesystems/ipfs.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix
index e2122ddb8ede..ab6d3a3d2fa4 100644
--- a/nixos/modules/services/network-filesystems/ipfs.nix
+++ b/nixos/modules/services/network-filesystems/ipfs.nix
@@ -186,6 +186,14 @@ in {
         default = [];
       };
 
+      localDiscovery = mkOption {
+        type = types.bool;
+        description = ''Whether to enable local discovery for the ipfs daemon.
+          This will allow ipfs to scan ports on your local network. Some hosting services will ban you if you do this.
+        '';
+        default = true;
+      };
+
       serviceFdlimit = mkOption {
         type = types.nullOr types.int;
         default = null;
@@ -232,7 +240,13 @@ in {
       '';
       script = ''
         if [[ ! -f ${cfg.dataDir}/config ]]; then
-          ipfs init ${optionalString cfg.emptyRepo "-e"}
+          ipfs init ${optionalString cfg.emptyRepo "-e"} \
+            ${optionalString (! cfg.localDiscovery) "--profile=server"}
+        else
+          ${if cfg.localDiscovery
+            then "ipfs config profile apply local-discovery"
+            else "ipfs config profile apply server"
+          }
         fi
       '';