9 cfg = config.services.torrentstream;
10 dataDir = "/var/lib/torrentstream/";
13 options.services.torrentstream = {
14 enable = lib.mkEnableOption "TorrentStream daemon";
15 package = lib.mkPackageOption pkgs "torrentstream" { };
17 type = lib.types.port;
23 openFirewall = lib.mkOption {
24 type = lib.types.bool;
27 Open ports in the firewall for TorrentStream daemon.
30 address = lib.mkOption {
38 config = lib.mkIf cfg.enable {
39 systemd.services.torrentstream = {
40 after = [ "network.target" ];
41 description = "TorrentStream Daemon";
42 wantedBy = [ "multi-user.target" ];
44 ExecStart = lib.getExe cfg.package;
45 Restart = "on-failure";
47 StateDirectory = "torrentstream";
51 WEB_PORT = toString cfg.port;
52 DOWNLOAD_PATH = "%S/torrentstream";
53 LISTEN_ADDR = cfg.address;
56 networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.port ];