lol
1{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, makeWrapper, icu, dotnet-runtime, openssl, nixosTests, zlib }:
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 aarch64-darwin = "arm64";
10 }."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
11
12 hash = {
13 x64-linux_hash = "sha256-rKe1xQR3lkPXQBUWmKdHUu/AQ99U1kCINeXV2z/ZG5o=";
14 arm64-linux_hash = "sha256-O/6brSo25E4BxvxAUQvwQa9kMY/Ga3YxgS+fuaL6/n0=";
15 x64-osx_hash = "sha256-oVBs0evwPl3Dd6GZlzUWqopB0Zq4mOCUwmLOjs44d6Q=";
16 arm64-osx_hash = "sha256-iUBy9ob2zOdKVhGbwsJx1ZrT9tD4D1BPLqjB46tCW08=";
17 }."${arch}-${os}_hash";
18
19in stdenv.mkDerivation rec {
20 pname = "radarr";
21 version = "5.6.0.8846";
22
23 src = fetchurl {
24 url = "https://github.com/Radarr/Radarr/releases/download/v${version}/Radarr.master.${version}.${os}-core-${arch}.tar.gz";
25 sha256 = hash;
26 };
27
28 nativeBuildInputs = [ makeWrapper ];
29
30 installPhase = ''
31 runHook preInstall
32
33 mkdir -p $out/{bin,share/${pname}-${version}}
34 cp -r * $out/share/${pname}-${version}/.
35
36 makeWrapper "${dotnet-runtime}/bin/dotnet" $out/bin/Radarr \
37 --add-flags "$out/share/${pname}-${version}/Radarr.dll" \
38 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
39 curl sqlite libmediainfo mono openssl icu zlib ]}
40
41 runHook postInstall
42 '';
43
44 passthru = {
45 updateScript = ./update.sh;
46 tests.smoke-test = nixosTests.radarr;
47 };
48
49 meta = with lib; {
50 description = "A Usenet/BitTorrent movie downloader";
51 homepage = "https://radarr.video/";
52 changelog = "https://github.com/Radarr/Radarr/releases/tag/v${version}";
53 license = licenses.gpl3Only;
54 maintainers = with maintainers; [ edwtjo purcell ];
55 mainProgram = "Radarr";
56 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
57 };
58}