deluge module: support specifying open file limit

We also increase the limit to 4096.
This commit is contained in:
Peter Hoeg 2016-05-23 22:12:52 +08:00 committed by Robert Helgesson
parent 5d69399184
commit 7e5a393e8c
No known key found for this signature in database
GPG Key ID: C3DB11069E65DC86

View File

@ -5,26 +5,36 @@ with lib;
let
cfg = config.services.deluge;
cfg_web = config.services.deluge.web;
openFilesLimit = 4096;
in {
options = {
services.deluge = {
enable = mkOption {
default = false;
example = true;
description = ''
Start Deluge daemon.
'';
};
};
services = {
deluge = {
enable = mkOption {
default = false;
example = true;
description = "Start the Deluge daemon";
};
services.deluge.web = {
enable = mkOption {
default = false;
example = true;
description = ''
Start Deluge Web daemon.
'';
};
openFilesLimit = mkOption {
default = openFilesLimit;
example = 8192;
description = ''
Number of files to allow deluged to open.
'';
};
};
deluge.web = {
enable = mkOption {
default = false;
example = true;
description = ''
Start Deluge Web daemon.
'';
};
};
};
};
@ -35,11 +45,14 @@ in {
description = "Deluge BitTorrent Daemon";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.pythonPackages.deluge ];
serviceConfig.ExecStart = "${pkgs.pythonPackages.deluge}/bin/deluged -d";
# To prevent "Quit & shutdown daemon" from working; we want systemd to manage it!
serviceConfig.Restart = "on-success";
serviceConfig.User = "deluge";
serviceConfig.Group = "deluge";
serviceConfig = {
ExecStart = "${pkgs.pythonPackages.deluge}/bin/deluged -d";
# To prevent "Quit & shutdown daemon" from working; we want systemd to manage it!
Restart = "on-success";
User = "deluge";
Group = "deluge";
LimitNOFILE = cfg.openFilesLimit;
};
};
systemd.services.delugeweb = mkIf cfg_web.enable {