lol
1{ lib, stdenv, fetchurl, libmediainfo, sqlite, curl, makeWrapper, icu, dotnet-runtime, openssl, nixosTests }:
2
3let
4 os = if stdenv.isDarwin then "osx" else "linux";
5 arch = {
6 x86_64-linux = "x64";
7 aarch64-linux = "arm64";
8 x86_64-darwin = "x64";
9 }."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
10 hash = {
11 x64-linux_hash = "sha256-EBXK8MGgEOEu99X8n0i7mAoEBpqP9l+PtBlig0NW/Y8=";
12 arm64-linux_hash = "sha256-ZXIXjLnzjsT4nj5lbhg0yp97M9bdm8mo6Ypf3PAHlXc=";
13 x64-osx_hash = "sha256-RR3nyY7KyQXCimmknNEK6en98Q4D+PcFOi8lPAwdp9Q=";
14 }."${arch}-${os}_hash";
15in stdenv.mkDerivation rec {
16 pname = "readarr";
17 version = "0.3.26.2526";
18
19 src = fetchurl {
20 url = "https://github.com/Readarr/Readarr/releases/download/v${version}/Readarr.develop.${version}.${os}-core-${arch}.tar.gz";
21 sha256 = hash;
22 };
23
24 nativeBuildInputs = [ makeWrapper ];
25
26 installPhase = ''
27 runHook preInstall
28
29 mkdir -p $out/{bin,share/${pname}-${version}}
30 cp -r * $out/share/${pname}-${version}/.
31 makeWrapper "${dotnet-runtime}/bin/dotnet" $out/bin/Readarr \
32 --add-flags "$out/share/${pname}-${version}/Readarr.dll" \
33 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ curl sqlite libmediainfo icu openssl ]}
34
35 runHook postInstall
36 '';
37
38
39 passthru = {
40 updateScript = ./update.sh;
41 tests.smoke-test = nixosTests.readarr;
42 };
43
44 meta = with lib; {
45 description = "A Usenet/BitTorrent ebook downloader";
46 homepage = "https://readarr.com";
47 license = licenses.gpl3;
48 maintainers = [ maintainers.jocelynthode ];
49 mainProgram = "Readarr";
50 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
51 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
52 };
53}
54