nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 203 lines 6.6 kB view raw
1{ 2 lib, 3 stdenvNoCC, 4 fetchFromGitHub, 5 buildDotnetModule, 6 dotnetCorePackages, 7 sqlite, 8 withFFmpeg ? true, # replace bundled ffprobe binary with symlink to ffmpeg package. 9 servarr-ffmpeg, 10 fetchYarnDeps, 11 yarn, 12 fixup-yarn-lock, 13 nodejs, 14 nixosTests, 15 # update script 16 writers, 17 python3Packages, 18 nix, 19 prefetch-yarn-deps, 20 fetchpatch, 21 applyPatches, 22}: 23let 24 version = "6.0.4.10291"; 25 # The dotnet8 compatibility patches also change `yarn.lock`, so we must pass 26 # the already patched lockfile to `fetchYarnDeps`. 27 src = applyPatches { 28 src = fetchFromGitHub { 29 owner = "Radarr"; 30 repo = "Radarr"; 31 tag = "v${version}"; 32 hash = "sha256-SDkLVKHTqAnZQ4AYIW9fHvnga8EV/NVfzia/Ce0G+Uc="; 33 }; 34 postPatch = '' 35 mv src/NuGet.config NuGet.Config 36 ''; 37 patches = lib.optionals (lib.versionOlder version "6.0") [ 38 # See https://github.com/Radarr/Radarr/pull/11064 39 # Unfortunately, the .NET 8 upgrade will be merged into the v6 branch, 40 # and it may take some time for that to become stable. 41 # However, the patches cleanly apply to v5 as well. 42 (fetchpatch { 43 name = "dotnet8-compatibility"; 44 url = "https://github.com/Radarr/Radarr/commit/2235823af313ea1f39fd1189b69a75fc5d380c41.patch"; 45 hash = "sha256-3YgQV4xc2i5DNWp2KxVz6M5S8n//a/Js7pckGZ06fWc="; 46 }) 47 (fetchpatch { 48 name = "dotnet8-darwin-compatibility"; 49 url = "https://github.com/Radarr/Radarr/commit/2a886fb26a70b4d48a4ad08d7ee23e5e4d81f522.patch"; 50 hash = "sha256-SAMUHqlSj8FPq20wY8NWbRytVZXTPtMXMfM3CoM8kSA="; 51 }) 52 ]; 53 }; 54 rid = dotnetCorePackages.systemToDotnetRid stdenvNoCC.hostPlatform.system; 55in 56buildDotnetModule { 57 pname = "radarr"; 58 inherit version src; 59 60 strictDeps = true; 61 nativeBuildInputs = [ 62 nodejs 63 yarn 64 prefetch-yarn-deps 65 fixup-yarn-lock 66 ]; 67 68 yarnOfflineCache = fetchYarnDeps { 69 yarnLock = "${src}/yarn.lock"; 70 hash = "sha256-Ng7ZsUfGBKtNktJeuI4Q6+tMN2ZPj+pVSQ+0Ssy5gRc="; 71 }; 72 73 ffprobe = lib.optionalDrvAttr withFFmpeg (lib.getExe' servarr-ffmpeg "ffprobe"); 74 75 postConfigure = '' 76 yarn config --offline set yarn-offline-mirror "$yarnOfflineCache" 77 fixup-yarn-lock yarn.lock 78 yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive 79 patchShebangs --build node_modules 80 ''; 81 postBuild = '' 82 yarn --offline run build --env production 83 ''; 84 postInstall = 85 lib.optionalString withFFmpeg '' 86 rm -- "$out/lib/radarr/ffprobe" 87 ln -s -- "$ffprobe" "$out/lib/radarr/ffprobe" 88 '' 89 + '' 90 cp -a -- _output/UI "$out/lib/radarr/UI" 91 ''; 92 93 nugetDeps = ./deps.json; 94 95 runtimeDeps = [ sqlite ]; 96 97 dotnet-sdk = dotnetCorePackages.sdk_8_0; 98 dotnet-runtime = dotnetCorePackages.aspnetcore_8_0; 99 100 doCheck = true; 101 102 __darwinAllowLocalNetworking = true; # for tests 103 104 __structuredAttrs = true; # for Copyright property that contains spaces 105 106 executables = [ "Radarr" ]; 107 108 projectFile = [ 109 "src/NzbDrone.Console/Radarr.Console.csproj" 110 "src/NzbDrone.Mono/Radarr.Mono.csproj" 111 ]; 112 113 testProjectFile = [ 114 "src/NzbDrone.Api.Test/Radarr.Api.Test.csproj" 115 "src/NzbDrone.Common.Test/Radarr.Common.Test.csproj" 116 "src/NzbDrone.Core.Test/Radarr.Core.Test.csproj" 117 "src/NzbDrone.Host.Test/Radarr.Host.Test.csproj" 118 "src/NzbDrone.Libraries.Test/Radarr.Libraries.Test.csproj" 119 "src/NzbDrone.Mono.Test/Radarr.Mono.Test.csproj" 120 "src/NzbDrone.Test.Common/Radarr.Test.Common.csproj" 121 ]; 122 123 dotnetFlags = [ 124 "--property:TargetFramework=net8.0" 125 "--property:EnableAnalyzers=false" 126 "--property:SentryUploadSymbols=false" # Fix Sentry upload failed warnings 127 # Override defaults in src/Directory.Build.props that use current time. 128 "--property:Copyright=Copyright 2014-2025 radarr.video (GNU General Public v3)" 129 "--property:AssemblyVersion=${version}" 130 "--property:AssemblyConfiguration=master" 131 "--property:RuntimeIdentifier=${rid}" 132 ]; 133 134 # Skip manual, integration, automation and platform-dependent tests. 135 testFilters = [ 136 "TestCategory!=ManualTest" 137 "TestCategory!=IntegrationTest" 138 "TestCategory!=AutomationTest" 139 140 # makes real HTTP requests 141 "FullyQualifiedName!~NzbDrone.Core.Test.UpdateTests.UpdatePackageProviderFixture" 142 ] 143 ++ lib.optionals stdenvNoCC.buildPlatform.isDarwin [ 144 # fails on macOS 145 "FullyQualifiedName!~NzbDrone.Core.Test.Http.HttpProxySettingsProviderFixture" 146 ]; 147 148 disabledTests = [ 149 # setgid tests 150 "NzbDrone.Mono.Test.DiskProviderTests.DiskProviderFixture.should_preserve_setgid_on_set_folder_permissions" 151 "NzbDrone.Mono.Test.DiskProviderTests.DiskProviderFixture.should_clear_setgid_on_set_folder_permissions" 152 153 # we do not set application data directory during tests (i.e. XDG data directory) 154 "NzbDrone.Mono.Test.DiskProviderTests.FreeSpaceFixture.should_return_free_disk_space" 155 "NzbDrone.Common.Test.ServiceFactoryFixture.event_handlers_should_be_unique" 156 157 # attempts to read /etc/*release and fails since it does not exist 158 "NzbDrone.Mono.Test.EnvironmentInfo.ReleaseFileVersionAdapterFixture.should_get_version_info" 159 160 # fails to start test dummy because it cannot locate .NET runtime for some reason 161 "NzbDrone.Common.Test.ProcessProviderFixture.should_be_able_to_start_process" 162 "NzbDrone.Common.Test.ProcessProviderFixture.exists_should_find_running_process" 163 "NzbDrone.Common.Test.ProcessProviderFixture.kill_all_should_kill_all_process_with_name" 164 ] 165 ++ lib.optionals stdenvNoCC.buildPlatform.isDarwin [ 166 # flaky on darwin 167 "NzbDrone.Core.Test.NotificationTests.TraktServiceFixture.should_add_collection_movie_if_valid_mediainfo" 168 "NzbDrone.Core.Test.NotificationTests.TraktServiceFixture.should_format_audio_channels_to_one_decimal_when_adding_collection_movie" 169 ]; 170 171 passthru = { 172 tests = { 173 inherit (nixosTests) radarr; 174 }; 175 176 updateScript = writers.writePython3 "radarr-updater" { 177 libraries = with python3Packages; [ requests ]; 178 flakeIgnore = [ "E501" ]; 179 makeWrapperArgs = [ 180 "--prefix" 181 "PATH" 182 ":" 183 (lib.makeBinPath [ 184 nix 185 prefetch-yarn-deps 186 ]) 187 ]; 188 } ./update.py; 189 }; 190 191 meta = { 192 description = "Usenet/BitTorrent movie downloader"; 193 homepage = "https://radarr.video"; 194 changelog = "https://github.com/Radarr/Radarr/releases/tag/v${version}"; 195 license = lib.licenses.gpl3Only; 196 maintainers = with lib.maintainers; [ 197 purcell 198 nyanloutre 199 ]; 200 mainProgram = "Radarr"; 201 # platforms inherited from dotnet-sdk. 202 }; 203}