2013-02-24 16:33:48 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.deluge;
|
|
|
|
cfg_web = config.services.deluge.web;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.deluge = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2013-02-25 21:39:47 +00:00
|
|
|
example = true;
|
2013-02-24 16:33:48 +00:00
|
|
|
description = ''
|
|
|
|
Start Deluge daemon.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.deluge.web = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2013-02-25 21:39:47 +00:00
|
|
|
example = true;
|
2013-02-24 16:33:48 +00:00
|
|
|
description = ''
|
|
|
|
Start Deluge Web daemon.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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.pythonPackages.deluge ];
|
2013-02-27 19:13:14 +00:00
|
|
|
serviceConfig.ExecStart = "${pkgs.pythonPackages.deluge}/bin/deluged -d";
|
2013-02-26 21:53:52 +00:00
|
|
|
serviceConfig.User = "deluge";
|
|
|
|
serviceConfig.Group = "deluge";
|
2013-02-24 16:33:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.delugeweb = mkIf cfg_web.enable {
|
2013-02-27 19:06:10 +00:00
|
|
|
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.pythonPackages.deluge ];
|
2013-02-27 19:13:14 +00:00
|
|
|
serviceConfig.ExecStart = "${pkgs.pythonPackages.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.pythonPackages.deluge ];
|
|
|
|
|
|
|
|
users.extraUsers.deluge = {
|
|
|
|
group = "deluge";
|
2013-08-23 09:33:24 +00:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
|
2013-08-23 09:33:24 +00:00
|
|
|
users.extraGroups.deluge.gid = config.ids.gids.deluge;
|
2013-02-24 16:33:48 +00:00
|
|
|
};
|
|
|
|
}
|