nixpkgs/pkgs/servers/bazarr/default.nix
K900 0481587e35 bazarr: use libarchive instead of unar
unar is ObjC, doesn't build currently and is largely dead.
Bazarr only uses it to unpack RAR archives, so just give it
libarchive bsdtar instead, which can handle any reasonable archive,
is not unfree and is not dead.
2024-07-26 10:20:16 +03:00

65 lines
1.5 KiB
Nix

{ stdenv, lib, fetchurl, makeWrapper, unzip, python3, libarchive, ffmpeg, nixosTests }:
let
runtimeProgDeps = [
ffmpeg
libarchive
];
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;
};
}