depot/third_party/nixpkgs/pkgs/servers/bazarr/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

64 lines
1.5 KiB
Nix

{ stdenv, lib, fetchurl, makeWrapper, unzip, python3, unar, ffmpeg, nixosTests }:
let
runtimeProgDeps = [
ffmpeg
unar
];
in
stdenv.mkDerivation rec {
pname = "bazarr";
version = "1.4.3";
sourceRoot = ".";
src = fetchurl {
url = "https://github.com/morpheus65535/bazarr/releases/download/v${version}/bazarr.zip";
sha256 = "sha256-tmTdmUfRBRlB14juNxUo65Re+9agUBX0BBSuNu3pSC0=";
};
nativeBuildInputs = [ unzip makeWrapper ];
buildInputs = [
(python3.withPackages (ps: [
ps.lxml
ps.numpy
ps.gevent
ps.gevent-websocket
ps.pillow
ps.setuptools
]))
] ++ runtimeProgDeps;
installPhase = ''
runHook preInstall
mkdir -p "$out"/{bin,share/${pname}}
cp -r * "$out/share/${pname}"
# Add missing shebang and execute perms so that patchShebangs can do its
# thing.
sed -i "1i #!/usr/bin/env python3" "$out/share/${pname}/bazarr.py"
chmod +x "$out/share/${pname}/bazarr.py"
makeWrapper "$out/share/${pname}/bazarr.py" \
"$out/bin/bazarr" \
--suffix PATH : ${lib.makeBinPath runtimeProgDeps}
runHook postInstall
'';
passthru.tests = {
smoke-test = nixosTests.bazarr;
};
meta = with lib; {
description = "Subtitle manager for Sonarr and Radarr";
homepage = "https://www.bazarr.media/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.gpl3Only;
maintainers = with maintainers; [ d-xo ];
mainProgram = "bazarr";
platforms = platforms.all;
};
}