Skip to content

Commit

Permalink
feat: add torrserver support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnvgr committed Apr 6, 2024
1 parent f4b5c21 commit 1368545
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hosts/cloud/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
dbPath = "/home/user/vkrdb";
dbEnv = ./secrets/vkrdb;
};

torrserver.enable = true;
};
};

Expand Down
1 change: 1 addition & 0 deletions modules/server/misc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ in {

imports = [
./vkreborn
./torrserver
];
}
33 changes: 33 additions & 0 deletions modules/server/misc/torrserver/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ pkgs, lib, config, ... }:
let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.modules.server.misc.torrserver;

pkg = pkgs.stdenv.mkDerivation rec {
pname = "torrserver";
version = "130";

src = pkgs.fetchurl {
url = "https://github.com/YouROK/TorrServer/releases/download/MatriX.${version}/TorrServer-linux-amd64";
hash = "sha256-oUoa+/3GI4dx2qqJI4A3K1tSUeZnXTyeud5Zfg7rJag=";
};

nativeBuildInputs = with pkgs; [ autoPatchelfHook ];

phases = "installPhase";
installPhase = ''
runHook preInstall
install -Dm755 $src $out/bin/torrserver
runHook postInstall
'';
};
in {
options.modules.server.misc.torrserver = {
enable = mkEnableOption "torrserver";
};

config = mkIf cfg.enable {
# TODO: systemd service
environment.systemPackages = [ pkg ];
};
}

0 comments on commit 1368545

Please sign in to comment.