lidarr: 0.8.1.2135 -> 1.0.2.2592

J2ghz aa5e70ec a7a5b8d5

+74 -15
+32 -15
pkgs/servers/lidarr/default.nix
··· 1 - { lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, chromaprint, makeWrapper }: 1 + { lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, chromaprint, makeWrapper, icu, dotnet-runtime, openssl, nixosTests }: 2 2 3 - stdenv.mkDerivation rec { 3 + let 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-iuI24gT7/RFZ9xc4csd+zWEzPSPsxqYY5F+78IWRjxQ="; 12 + arm64-linux_hash = "sha256-yHAoZxLeKF6mlR/Av0EH0Lh2XquM9Vx6huNDTEs4wyU="; 13 + x64-osx_hash = "sha256-ES6njZTSfd/36+RvibE1hlQlCT+hEEcOem8epBSsnXc="; 14 + }."${arch}-${os}_hash"; 15 + in stdenv.mkDerivation rec { 4 16 pname = "lidarr"; 5 - version = "0.8.1.2135"; 17 + version = "1.0.2.2592"; 6 18 7 19 src = fetchurl { 8 - url = "https://github.com/lidarr/Lidarr/releases/download/v${version}/Lidarr.master.${version}.linux.tar.gz"; 9 - sha256 = "sha256-eJX6t19D2slX68fXSMd/Vix3XSgCVylK+Wd8VH9jsuI="; 20 + url = "https://github.com/lidarr/Lidarr/releases/download/v${version}/Lidarr.master.${version}.${os}-core-${arch}.tar.gz"; 21 + sha256 = hash; 10 22 }; 11 23 12 24 nativeBuildInputs = [ makeWrapper ]; 13 25 14 26 installPhase = '' 15 - mkdir -p $out/bin 16 - cp -r * $out/bin/ 27 + runHook preInstall 17 28 18 - # Mark main executable as executable 19 - chmod +x $out/bin/Lidarr.exe 29 + mkdir -p $out/{bin,share/${pname}-${version}} 30 + cp -r * $out/share/${pname}-${version}/. 31 + makeWrapper "${dotnet-runtime}/bin/dotnet" $out/bin/Lidarr \ 32 + --add-flags "$out/share/${pname}-${version}/Lidarr.dll" \ 33 + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ 34 + curl sqlite libmediainfo icu openssl ]} 20 35 21 - makeWrapper "${mono}/bin/mono" $out/bin/Lidarr \ 22 - --add-flags "$out/bin/Lidarr.exe" \ 23 - --prefix PATH : ${lib.makeBinPath [ chromaprint ]} \ 24 - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ 25 - curl sqlite libmediainfo ]} 36 + runHook postInstall 26 37 ''; 27 38 39 + 40 + passthru = { 41 + updateScript = ./update.sh; 42 + tests.smoke-test = nixosTests.lidarr; 43 + }; 44 + 28 45 meta = with lib; { 29 46 description = "A Usenet/BitTorrent music downloader"; 30 47 homepage = "https://lidarr.audio/"; 31 48 license = licenses.gpl3; 32 49 maintainers = [ maintainers.etu ]; 33 - platforms = platforms.all; 50 + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; 34 51 }; 35 52 }
+42
pkgs/servers/lidarr/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl gnused nix-prefetch jq 3 + 4 + set -e 5 + 6 + dirname="$(dirname "$0")" 7 + 8 + updateHash() 9 + { 10 + version=$1 11 + arch=$2 12 + os=$3 13 + 14 + hashKey="${arch}-${os}_hash" 15 + 16 + url="https://github.com/Lidarr/Lidarr/releases/download/v$version/Lidarr.master.$version.$os-core-$arch.tar.gz" 17 + hash=$(nix-prefetch-url --type sha256 $url) 18 + sriHash="$(nix hash to-sri --type sha256 $hash)" 19 + 20 + sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix" 21 + } 22 + 23 + updateVersion() 24 + { 25 + sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix" 26 + } 27 + 28 + currentVersion=$(cd $dirname && nix eval --raw -f ../../.. radarr.version) 29 + 30 + latestTag=$(curl https://api.github.com/repos/Lidarr/Lidarr/releases/latest | jq -r ".tag_name") 31 + latestVersion="$(expr $latestTag : 'v\(.*\)')" 32 + 33 + if [[ "$currentVersion" == "$latestVersion" ]]; then 34 + echo "Lidarr is up-to-date: ${currentVersion}" 35 + exit 0 36 + fi 37 + 38 + updateVersion $latestVersion 39 + 40 + updateHash $latestVersion x64 linux 41 + updateHash $latestVersion arm64 linux 42 + updateHash $latestVersion x64 osx