sonarr: 3.0.10.1567 -> 4.0.0.748

This commit is contained in:
Steve Purcell 2024-01-01 11:45:58 +00:00
parent 522f476e56
commit a907d05c50
3 changed files with 68 additions and 13 deletions

View File

@ -277,6 +277,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
- New options were added to the dnsdist module to enable and configure a DNSCrypt endpoint (see `services.dnsdist.dnscrypt.enable`, etc.).
The module can generate the DNSCrypt provider key pair, certificates and also performs their rotation automatically with no downtime.
- With a bump to `sonarr` v4, existing config database files will be upgraded automatically, but note that some old apparently-working configs [might actually be corrupt and fail to upgrade cleanly](https://forums.sonarr.tv/t/sonarr-v4-released/33089).
- The Yama LSM is now enabled by default in the kernel, which prevents ptracing
non-child processes. This means you will not be able to attach gdb to an
existing process, but will need to start that process from gdb (so it is a

View File

@ -1,12 +1,28 @@
{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, makeWrapper, nixosTests }:
{ lib, stdenv, fetchurl, dotnet-runtime, icu, ffmpeg, openssl, sqlite, curl, makeWrapper, nixosTests }:
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-XCCqAMxaOk9vGlTDHv7MB6VhTx0ODDTuPxkfvTBeJDk=";
arm64-linux_hash = "sha256-4jQzgjicPh4AmO2jY3h8YXlTlvIbk4uyDxMpOQtm+HI=";
x64-osx_hash = "sha256-MYLbAg9oCjWaZEMnSBmLEDEpab9vvcJjI8P8Fdmhmzs=";
arm64-osx_hash = "sha256-FyHffgNVoS/HPXz2YQGyxRowT04VFKtWZYEvsBZ9t4E=";
}."${arch}-${os}_hash";
in
stdenv.mkDerivation rec {
pname = "sonarr";
version = "3.0.10.1567";
version = "4.0.0.748";
src = fetchurl {
url = "https://download.sonarr.tv/v3/main/${version}/Sonarr.main.${version}.linux.tar.gz";
hash = "sha256-6zdp/Bg+9pcrElW5neB+BC16Vn1VhTjhMRRIxGrKhxc=";
url = "https://download.sonarr.tv/v4/main/${version}/Sonarr.main.${version}.${os}-${arch}.tar.gz";
inherit hash;
};
nativeBuildInputs = [ makeWrapper ];
@ -14,12 +30,13 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r * $out/bin/
makeWrapper "${mono}/bin/mono" $out/bin/NzbDrone \
--add-flags "$out/bin/Sonarr.exe" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
curl sqlite libmediainfo ]}
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 ]}
runHook postInstall
'';

View File

@ -1,7 +1,43 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
#!nix-shell -i bash -p curl gnused nix-prefetch jq
set -e
dirname="$(dirname "$0")"
updateHash()
{
version=$1
arch=$2
os=$3
hashKey="${arch}-${os}_hash"
url="https://download.sonarr.tv/v4/main/${version}/Sonarr.main.${version}.${os}-${arch}.tar.gz";
hash=$(nix-prefetch-url --type sha256 $url)
sriHash="$(nix hash to-sri --type sha256 $hash)"
sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix"
}
updateVersion()
{
sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
}
currentVersion=$(cd $dirname && nix eval --raw -f ../../.. sonarr.version)
latestTag=$(curl https://api.github.com/repos/Sonarr/Sonarr/tags | jq -r '.[] | .name' | sort --version-sort | tail -1)
version="$(expr $latestTag : 'v\(.*\)')"
latestVersion="$(expr $latestTag : 'v\(.*\)')"
update-source-version sonarr "$version"
if [[ "$currentVersion" == "$latestVersion" ]]; then
echo "Sonarr is up-to-date: ${currentVersion}"
exit 0
fi
updateVersion $latestVersion
updateHash $latestVersion x64 linux
updateHash $latestVersion arm64 linux
updateHash $latestVersion x64 osx
updateHash $latestVersion arm64 osx