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

57 lines
1.8 KiB
Nix

{ lib, stdenv, fetchurl, dotnet-runtime, icu, ffmpeg, openssl, sqlite, curl, makeWrapper, nixosTests, zlib }:
let
os = if stdenv.isDarwin then "osx" else "linux";
arch = {
x86_64-linux = "x64";
aarch64-linux = "arm64";
x86_64-darwin = "x64";
aarch64-darwin = "arm64";
}."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
hash = {
x64-linux_hash = "sha256-MkRKWMhH4x5Z9mURh8qpShaozHrBFOHHwTmFlU1wqS8=";
arm64-linux_hash = "sha256-OIwWZEW4qmL5359hmGdNzunxVTIT3hIbTdAsd5Cpw/k=";
x64-osx_hash = "sha256-uDQXfj4r56ewrhZdwOnF78L3M1o0jDLt/PZlfWxxV18=";
arm64-osx_hash = "sha256-6WUeMIfF5juNHrLqep3mONqfcgxlBJOOJmHJkyHpZhU=";
}."${arch}-${os}_hash";
in
stdenv.mkDerivation rec {
pname = "sonarr";
version = "4.0.5.1710";
src = fetchurl {
url = "https://github.com/Sonarr/Sonarr/releases/download/v${version}/Sonarr.main.${version}.${os}-${arch}.tar.gz";
inherit hash;
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,share/sonarr-${version}}
cp -r * $out/share/sonarr-${version}/.
makeWrapper "${dotnet-runtime}/bin/dotnet" $out/bin/NzbDrone \
--add-flags "$out/share/sonarr-${version}/Sonarr.dll" \
--prefix PATH : ${lib.makeBinPath [ ffmpeg ]} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ curl sqlite openssl icu zlib ]}
runHook postInstall
'';
passthru = {
updateScript = ./update.sh;
tests.smoke-test = nixosTests.sonarr;
};
meta = {
description = "Smart PVR for newsgroup and bittorrent users";
homepage = "https://sonarr.tv/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ fadenb purcell ];
mainProgram = "NzbDrone";
platforms = lib.platforms.all;
};
}