68 lines
1.7 KiB
Nix
68 lines
1.7 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
uid = config.ids.uids.deluge;
|
|
gid = config.ids.gids.deluge;
|
|
cfg = config.services.deluge;
|
|
cfg_web = config.services.deluge.web;
|
|
in {
|
|
options = {
|
|
services.deluge = {
|
|
enable = mkOption {
|
|
default = false;
|
|
example = true;
|
|
description = ''
|
|
Start Deluge daemon.
|
|
'';
|
|
};
|
|
};
|
|
|
|
services.deluge.web = {
|
|
enable = mkOption {
|
|
default = false;
|
|
example = true;
|
|
description = ''
|
|
Start Deluge Web daemon.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.deluged = {
|
|
after = [ "network.target" ];
|
|
description = "Deluge BitTorrent Daemon";
|
|
wantedBy = [ "multi-user.target" ];
|
|
path = [ pkgs.pythonPackages.deluge ];
|
|
script = "${pkgs.pythonPackages.deluge}/bin/deluged -d";
|
|
serviceConfig.User = "deluge";
|
|
serviceConfig.Group = "deluge";
|
|
};
|
|
|
|
systemd.services.delugeweb = mkIf cfg_web.enable {
|
|
after = [ "network.target" "deluged.service" ];
|
|
description = "Deluge BitTorrent WebUI";
|
|
wantedBy = [ "multi-user.target" ];
|
|
wants = [ "deluged.service" ];
|
|
path = [ pkgs.pythonPackages.deluge ];
|
|
script = "${pkgs.pythonPackages.deluge}/bin/deluge --ui web";
|
|
serviceConfig.User = "deluge";
|
|
serviceConfig.Group = "deluge";
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.pythonPackages.deluge ];
|
|
|
|
users.extraUsers.deluge = {
|
|
inherit uid;
|
|
group = "deluge";
|
|
home = "/var/lib/deluge/";
|
|
createHome = true;
|
|
description = "Deluge Daemon user";
|
|
};
|
|
|
|
users.extraGroups.deluge.gid = gid;
|
|
};
|
|
}
|