feat: Add rqbot module and enable it
This commit is contained in:
parent
7f67895696
commit
3c31147f9d
3 changed files with 69 additions and 0 deletions
|
|
@ -40,6 +40,12 @@
|
|||
enable = true;
|
||||
serverName = "im.youthlic.social";
|
||||
};
|
||||
rqbit = {
|
||||
enable = true;
|
||||
unixName = "alice";
|
||||
ratelimitUpload = 0;
|
||||
httpHost = "100.76.229.45";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@
|
|||
# emacs.enable = true;
|
||||
sunshine.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
rqbit = {
|
||||
enable = true;
|
||||
unixName = "david";
|
||||
ratelimitUpload = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
58
nixos/modules/programs/rqbit.nix
Normal file
58
nixos/modules/programs/rqbit.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
cfg = config.youthlic.programs.rqbit;
|
||||
in {
|
||||
options = {
|
||||
youthlic.programs.rqbit = {
|
||||
enable = lib.mkEnableOption "rqbit";
|
||||
unixName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
ratelimitUpload = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = ''
|
||||
Limit upload to mega-bytes-per-second
|
||||
'';
|
||||
};
|
||||
httpHost = options.services.rqbit.httpHost;
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.rqbit = {
|
||||
inherit (cfg) httpHost;
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
httpPort = 9092;
|
||||
};
|
||||
users.groups.rqbit.members = [cfg.unixName];
|
||||
systemd.services."rqbit" = {
|
||||
serviceConfig = {
|
||||
EnvironmentFile = [
|
||||
(toString
|
||||
(
|
||||
pkgs.writeText
|
||||
"rqbit-env.env"
|
||||
( # env
|
||||
# ''
|
||||
# RQBIT_TRACKERS_FILENAME=${pkgs.trackerslist}/trackers_all.txt
|
||||
# ''
|
||||
''
|
||||
RQBIT_TRACKERS_FILENAME=${pkgs.TrackersListCollection}/all.txt
|
||||
''
|
||||
+ (lib.optionalString (cfg.ratelimitUpload != 0)
|
||||
# env
|
||||
''
|
||||
RQBIT_RATELIMIT_UPLOAD=${toString (cfg.ratelimitUpload * 1024 * 1024)}
|
||||
'')
|
||||
)
|
||||
))
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue