blob: 93a7b43d7693653b7a1be73f1f8e7b69b23b7210 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
{ config, lib, pkgs, ... }:
let
mylib = import <top/lib.nix>;
cfg = config.torrent;
in
{
options.torrent = {
qbittorrentWebUiPort = lib.mkOption {
type = lib.types.int;
};
networkNamespace = lib.mkOption {
type = lib.types.str;
};
};
config = {
environment.systemPackages = [pkgs.qbittorrent-nox];
users.extraUsers.qbittorrent = {
isSystemUser = true;
group = "qbittorrent";
home = "/var/lib/qbittorrent";
createHome = true;
};
users.groups.qbittorrent = {};
systemd = {
packages = [pkgs.qbittorrent-nox];
services."qbittorrent" = mylib.joinWgNamespace cfg.networkNamespace {
enable = true;
path = [pkgs.qbittorrent-nox];
serviceConfig = {
ExecStart = "${pkgs.qbittorrent-nox}/bin/qbittorrent-nox --webui-port=${toString cfg.qbittorrentWebUiPort}";
User = "qbittorrent";
};
wantedBy = ["multi-user.target"];
};
services.qbittorrent-webui-proxy = mylib.mkPortProxy "qbittorrent" cfg.networkNamespace cfg.qbittorrentWebUiPort;
};
};
}
|