nixpkgs/pkgs/by-name/rq/rqbit/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

83 lines
1.7 KiB
Nix
Raw Permalink Normal View History

2024-10-30 09:16:43 +00:00
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
pkg-config,
openssl,
darwin,
buildNpmPackage,
nodejs_20,
}:
let
2021-10-23 02:50:03 +00:00
pname = "rqbit";
2024-10-30 09:16:43 +00:00
version = "7.0.1";
2021-10-23 02:50:03 +00:00
src = fetchFromGitHub {
owner = "ikatson";
repo = "rqbit";
rev = "v${version}";
2024-10-30 09:16:43 +00:00
hash = "sha256-Lt3HxK8fB1Xn2422wGkJ90muJjZ7r9ZHngGD/2tkaMM=";
2021-10-23 02:50:03 +00:00
};
2024-10-30 09:16:43 +00:00
rqbit-webui = buildNpmPackage {
pname = "rqbit-webui";
nodejs = nodejs_20;
inherit version src;
sourceRoot = "${src.name}/crates/librqbit/webui";
npmDepsHash = "sha256-VYPZXZx9rKLKZm5+d2wSVkoPLCQCffaeZVSi7mKRH/M=";
installPhase = ''
runHook preInstall
mkdir -p $out/dist
cp -r dist/** $out/dist
runHook postInstall
'';
};
2024-10-30 09:16:43 +00:00
in
rustPlatform.buildRustPackage {
inherit pname version src;
cargoHash = "sha256-esDUzzVm5J8fKftBfk5StJzN1YzLa1p0t7BsoxzrowI=";
nativeBuildInputs = lib.optionals stdenv.isLinux [
pkg-config
];
buildInputs =
lib.optionals stdenv.isLinux [ openssl ]
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ];
2021-10-23 02:50:03 +00:00
2024-10-30 09:16:43 +00:00
preConfigure = ''
mkdir -p crates/librqbit/webui/dist
cp -R ${rqbit-webui}/dist/** crates/librqbit/webui/dist
'';
2021-10-23 02:50:03 +00:00
2024-10-30 09:16:43 +00:00
postPatch = ''
# This script fascilitates the build of the webui,
# we've already built that
rm crates/librqbit/build.rs
'';
2021-10-23 02:50:03 +00:00
doCheck = false;
meta = with lib; {
description = "Bittorrent client in Rust";
homepage = "https://github.com/ikatson/rqbit";
changelog = "https://github.com/ikatson/rqbit/releases/tag/v${version}";
2021-10-23 02:50:03 +00:00
license = licenses.asl20;
2024-10-30 09:16:43 +00:00
maintainers = with maintainers; [
cafkafk
toasteruwu
];
mainProgram = "rqbit";
2021-10-23 02:50:03 +00:00
};
}