mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
refactor: systems/ folder
This commit is contained in:
parent
a06248ba9a
commit
41b772c6d1
22 changed files with 10 additions and 10 deletions
55
systems/tewi/deluge.nix
Normal file
55
systems/tewi/deluge.nix
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{ config, utils, lib, ... }: let
|
||||
inherit (lib) mkAfter;
|
||||
cfg = config.services.deluge;
|
||||
shadowDir = "/mnt/shadow";
|
||||
mediaDir = "${shadowDir}/deluge";
|
||||
in {
|
||||
sops.secrets.deluge-auth = {
|
||||
inherit (cfg) group;
|
||||
owner = cfg.user;
|
||||
};
|
||||
services.deluge = {
|
||||
enable = true;
|
||||
declarative = true;
|
||||
openFirewall = true;
|
||||
web = {
|
||||
enable = true;
|
||||
};
|
||||
config = {
|
||||
download_location = "${mediaDir}/download";
|
||||
move_completed_path = "${mediaDir}/complete";
|
||||
move_completed = true;
|
||||
max_upload_speed = 10.0;
|
||||
#share_ratio_limit = 2.0;
|
||||
max_connections_global = 1024;
|
||||
max_connections_per_second = 50;
|
||||
max_active_limit = 100;
|
||||
max_active_downloading = 75;
|
||||
max_upload_slots_global = 25;
|
||||
max_active_seeding = 1;
|
||||
allow_remote = true;
|
||||
daemon_port = 58846;
|
||||
listen_ports = [ 6881 6889 ];
|
||||
random_port = false;
|
||||
};
|
||||
authFile = config.sops.secrets.deluge-auth.path;
|
||||
};
|
||||
systemd.services = {
|
||||
deluged = {
|
||||
bindsTo = [
|
||||
"${utils.escapeSystemdPath shadowDir}.mount"
|
||||
];
|
||||
unitConfig = {
|
||||
RequiresMountsFor = [
|
||||
shadowDir
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
systemd.tmpfiles.rules = mkAfter [
|
||||
# work around https://github.com/NixOS/nixpkgs/blob/8f40f2f90b9c9032d1b824442cfbbe0dbabd0dbd/nixos/modules/services/torrent/deluge.nix#L205-L210
|
||||
# (this is dumb, there's no guarantee the disk is even mounted)
|
||||
"z '${cfg.config.move_completed_path}' 0775 ${cfg.user} ${cfg.group}"
|
||||
"x '${mediaDir}/*'"
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue