radarr: 0.2.0.1504 -> 3.0.2.4552
Use dotnet core instead of mono, change license to gpl3Only, add test passthru and create update script
This commit is contained in:
parent
0213d5f933
commit
36497c2fde
2 changed files with 71 additions and 10 deletions
|
@ -1,12 +1,26 @@
|
|||
{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, makeWrapper }:
|
||||
{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, makeWrapper, icu, dotnetCorePackages, openssl, nixosTests }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
let
|
||||
os = if stdenv.isDarwin then "osx" else "linux";
|
||||
arch = {
|
||||
x86_64-linux = "x64";
|
||||
aarch64-linux = "arm64";
|
||||
x86_64-darwin = "x64";
|
||||
}."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
|
||||
hash = {
|
||||
x64-linux_hash = "sha256-bTh+Z5w5ZkL2iPteStqVcoFDGZIbpVjuXn20TZsfgtY=";
|
||||
arm64-linux_hash = "sha256-aIzVSIRuGNiIFJPToXCQwYsbICKuPtwKATnQhkxvJuA=";
|
||||
x64-osx_hash = "sha256-FxRSAJvRQya2x1kei6yRceGcyQ2mCaFveyeMGw0Jqw4=";
|
||||
}."${arch}-${os}_hash";
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "radarr";
|
||||
version = "0.2.0.1504";
|
||||
version = "3.0.2.4552";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/Radarr/Radarr/releases/download/v${version}/Radarr.develop.${version}.linux.tar.gz";
|
||||
sha256 = "1h7pqn39vxd0vr1fwrnvfpxv5vhh4zcr0s8h0zvgplay2z6b6bvb";
|
||||
url = "https://github.com/Radarr/Radarr/releases/download/v${version}/Radarr.master.${version}.${os}-core-${arch}.tar.gz";
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
@ -15,17 +29,22 @@ stdenv.mkDerivation rec {
|
|||
mkdir -p $out/{bin,share/${pname}-${version}}
|
||||
cp -r * $out/share/${pname}-${version}/.
|
||||
|
||||
makeWrapper "${mono}/bin/mono" $out/bin/Radarr \
|
||||
--add-flags "$out/share/${pname}-${version}/Radarr.exe" \
|
||||
makeWrapper "${dotnetCorePackages.netcore_3_1}/bin/dotnet" $out/bin/Radarr \
|
||||
--add-flags "$out/share/${pname}-${version}/Radarr.dll" \
|
||||
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
|
||||
curl sqlite libmediainfo ]}
|
||||
curl sqlite libmediainfo mono openssl icu ]}
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
tests.smoke-test = nixosTests.radarr;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Usenet/BitTorrent movie downloader";
|
||||
homepage = "https://radarr.video/";
|
||||
license = licenses.gpl3;
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ edwtjo purcell ];
|
||||
platforms = platforms.all;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
|
42
pkgs/servers/radarr/update.sh
Executable file
42
pkgs/servers/radarr/update.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl nix-prefetch jq
|
||||
|
||||
set -e
|
||||
|
||||
dirname="$(dirname "$0")"
|
||||
|
||||
updateHash()
|
||||
{
|
||||
version=$1
|
||||
arch=$2
|
||||
os=$3
|
||||
|
||||
hashKey="${arch}-${os}_hash"
|
||||
|
||||
url="https://github.com/Radarr/Radarr/releases/download/v$version/Radarr.master.$version.$os-core-$arch.tar.gz"
|
||||
hash=$(nix-prefetch-url --type sha256 $url)
|
||||
sriHash="$(nix 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 '(with import ../../.. {}; radarr.version)')
|
||||
|
||||
latestTag=$(curl https://api.github.com/repos/Radarr/Radarr/releases/latest | jq -r ".tag_name")
|
||||
latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
||||
|
||||
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "Radarr is up-to-date: ${currentVersion}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
updateVersion $latestVersion
|
||||
|
||||
updateHash $latestVersion x64 linux
|
||||
updateHash $latestVersion arm64 linux
|
||||
updateHash $latestVersion x64 osx
|
Loading…
Reference in a new issue