depot/ops/nixos/lib/deluge.nix

45 lines
1.1 KiB
Nix

# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ depot, lib, pkgs, rebuilder, config, ... }:
let
inherit (depot.ops) secrets;
in {
imports = [
./content.nix
];
users.users.deluge.extraGroups = [ "content" ];
users.users.lukegb.extraGroups = [ "deluge" ];
services.deluge = {
enable = true;
declarative = true;
openFirewall = true;
dataDir = "/store/deluge";
config = {
upnp = false;
natpmp = false;
max_active_seeding = 900;
max_active_downloading = 100;
max_active_limit = 1000;
move_completed_paths_list = [ "/store/content/Anime" "/store/content/Films" "/store/content/TV" ];
enabled_plugins = [ "Label" ];
};
authFile = config.my.vault.secrets.deluge-auth-file.path;
web.enable = true;
package = depot.pkgs.deluge;
};
my.vault.secrets.deluge-auth-file = {
reloadOrRestartUnits = ["deluged.service"];
group = "deluge";
template = ''
{{ with secret "kv/apps/deluge" }}
{{ .Data.data.authfile }}
{{ end }}
'';
};
}