summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Litak <elitak@gmail.com>2017-07-31 07:15:02 -0700
committerEric Litak <elitak@gmail.com>2017-08-30 08:17:34 -0700
commit952424217b0e0177362a7e9e00305abc22762a19 (patch)
tree3a241e83b34685df7ad527eeaf37eca5a9591d41
parent5f9bad6ceb75713c051ef722f5b57dd6c036a67a (diff)
downloadnixlib-952424217b0e0177362a7e9e00305abc22762a19.tar
nixlib-952424217b0e0177362a7e9e00305abc22762a19.tar.gz
nixlib-952424217b0e0177362a7e9e00305abc22762a19.tar.bz2
nixlib-952424217b0e0177362a7e9e00305abc22762a19.tar.lz
nixlib-952424217b0e0177362a7e9e00305abc22762a19.tar.xz
nixlib-952424217b0e0177362a7e9e00305abc22762a19.tar.zst
nixlib-952424217b0e0177362a7e9e00305abc22762a19.zip
ipfs: optionally manage ulimit -n in serviceConfig
-rw-r--r--nixos/modules/services/network-filesystems/ipfs.nix16
1 files changed, 13 insertions, 3 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix
index f93f5bcb6287..df8506dd3d41 100644
--- a/nixos/modules/services/network-filesystems/ipfs.nix
+++ b/nixos/modules/services/network-filesystems/ipfs.nix
@@ -8,6 +8,7 @@ let
   cfg = config.services.ipfs;
 
   ipfsFlags = toString ([
+    (optionalString (cfg.serviceFdlimit != null) "--manage-fdlimit=true")
     (optionalString cfg.autoMount   "--mount")
     (optionalString cfg.autoMigrate "--migrate")
     (optionalString cfg.enableGC    "--enable-gc")
@@ -129,6 +130,15 @@ in
         default = [];
       };
 
+      serviceFdlimit = mkOption {
+        type = types.nullOr types.int;
+        default = null;
+        description = ''
+          The fdlimit for the IPFS systemd unit or `null` to have the daemon attempt to manage it.
+        '';
+        example = 256*1024;
+      };
+
     };
   };
 
@@ -219,7 +229,7 @@ in
         Group = cfg.group;
         Restart = "on-failure";
         RestartSec = 1;
-      };
+      } // optionalAttrs (cfg.serviceFdlimit != null) { LimitNOFILE = cfg.serviceFdlimit; };
     };
 
     systemd.services.ipfs-offline = {
@@ -242,7 +252,7 @@ in
         Group = cfg.group;
         Restart = "on-failure";
         RestartSec = 1;
-      };
+      } // optionalAttrs (cfg.serviceFdlimit != null) { LimitNOFILE = cfg.serviceFdlimit; };
     };
 
     systemd.services.ipfs-norouting = {
@@ -265,7 +275,7 @@ in
         Group = cfg.group;
         Restart = "on-failure";
         RestartSec = 1;
-      };
+      } // optionalAttrs (cfg.serviceFdlimit != null) { LimitNOFILE = cfg.serviceFdlimit; };
     };
 
   };