Add torrent service

This commit is contained in:
Jakob Lechner 2023-05-02 00:09:33 +00:00
parent 32c4ebad26
commit 5d2c02b331
No known key found for this signature in database
GPG key ID: 996082EFB5906C10
6 changed files with 87 additions and 0 deletions

View file

@ -16,6 +16,7 @@ let
"rpool/nixos/home" = "/home";
"rpool/nixos/var/lib" = "/var/lib";
"rpool/nixos/var/log" = "/var/log";
"rpool/sturzbach" = "/sturzbach";
};
partitionScheme = {
efiBoot = "-part1";

View file

@ -1,6 +1,8 @@
{
imports = [
./dnsmasq.nix
./nginx.nix
./torrent.nix
./unifi-controller.nix
];
}

View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
networking.firewall.interfaces."enp3s4".allowedTCPPorts = [
#networking.firewall.allowedTCPPorts = [
80
443
];
}

View file

@ -0,0 +1,39 @@
{ lib, pkgs, ... }:
let
aria2RpcPort = 6800;
aria2ListenPort = 59832;
in
{
services.aria2 = {
enable = true;
rpcListenPort = aria2RpcPort;
extraArguments = lib.concatStringsSep " " [
"--auto-save-interval=60"
"--bt-hash-check-seed=true"
"--bt-max-peers=0"
"--bt-save-metadata=true"
"--check-integrity=true"
"--continue=true"
"--force-save=true"
"--input-file /var/lib/aria2/aria2.session"
"--max-concurrent-downloads=1000"
"--rpc-allow-origin-all=true"
"--rpc-listen-all"
"--seed-ratio=0.0"
];
listenPortRange = [
{
from = aria2ListenPort;
to = aria2ListenPort;
}
];
downloadDir = "/sturzbach";
};
networking.firewall = {
allowedTCPPorts = [ aria2ListenPort ];
interfaces."enp3s4".allowedTCPPorts = [ aria2RpcPort ];
};
services.nginx.virtualHosts."iron.bw.lan.jalr.de" = {
root = pkgs.ariang;
};
}

29
pkgs/ariang/default.nix Normal file
View file

@ -0,0 +1,29 @@
{ lib
, stdenvNoCC
, fetchurl
, unzip
, pkgs
}:
stdenvNoCC.mkDerivation rec {
pname = "ariang";
version = "1.3.4";
src = fetchurl {
url = "https://github.com/mayswind/AriaNg/releases/download/${version}/AriaNg-${version}.zip";
sha256 = "sha256-HYKPbDWOO531LXm4a0XZ3ZjzGom1ZbbkwyyBbp7Dduw=";
};
nativeBuildInputs = [ unzip ];
unpackPhase = ''
unpackFile $src
'';
dontBuild = true;
installPhase = ''
mkdir $out
cp -r * $out
'';
}

View file

@ -3,6 +3,7 @@ let
inherit (prev) callPackage;
in
{
ariang = callPackage ./ariang { };
fpvout = callPackage ./fpvout { };
mute-indicator = callPackage ./mute-indicator { };
pretix = callPackage ./pretix/pretix.nix { };