1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/modules/services/torrent/deluge.nix

69 lines
1.7 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2013-02-24 16:33:48 +00:00
with lib;
2013-02-24 16:33:48 +00:00
let
cfg = config.services.deluge;
cfg_web = config.services.deluge.web;
openFilesLimit = 4096;
2013-02-24 16:33:48 +00:00
in {
options = {
services = {
deluge = {
2018-01-10 00:50:28 +00:00
enable = mkEnableOption "Deluge daemon";
openFilesLimit = mkOption {
default = openFilesLimit;
example = 8192;
description = ''
Number of files to allow deluged to open.
'';
};
};
2013-02-24 16:33:48 +00:00
2018-01-10 00:50:28 +00:00
deluge.web.enable = mkEnableOption "Deluge Web daemon";
2013-02-24 16:33:48 +00:00
};
};
config = mkIf cfg.enable {
systemd.services.deluged = {
after = [ "network.target" ];
2013-02-26 21:53:52 +00:00
description = "Deluge BitTorrent Daemon";
2013-02-24 16:33:48 +00:00
wantedBy = [ "multi-user.target" ];
path = [ pkgs.deluge ];
serviceConfig = {
ExecStart = "${pkgs.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;
};
2013-02-24 16:33:48 +00:00
};
systemd.services.delugeweb = mkIf cfg_web.enable {
after = [ "network.target" ];
2013-02-26 21:53:52 +00:00
description = "Deluge BitTorrent WebUI";
2013-02-24 16:33:48 +00:00
wantedBy = [ "multi-user.target" ];
path = [ pkgs.deluge ];
serviceConfig.ExecStart = "${pkgs.deluge}/bin/deluge --ui web";
2013-02-26 21:53:52 +00:00
serviceConfig.User = "deluge";
serviceConfig.Group = "deluge";
2013-02-24 16:33:48 +00:00
};
environment.systemPackages = [ pkgs.deluge ];
2013-02-24 16:33:48 +00:00
users.users.deluge = {
2013-02-24 16:33:48 +00:00
group = "deluge";
uid = config.ids.uids.deluge;
2013-02-26 21:53:52 +00:00
home = "/var/lib/deluge/";
createHome = true;
2013-02-24 16:33:48 +00:00
description = "Deluge Daemon user";
};
users.groups.deluge.gid = config.ids.gids.deluge;
2013-02-24 16:33:48 +00:00
};
}