prowlarr: init at 0.1.1.978
This commit is contained in:
parent
0e1dba3824
commit
4228bbe0b2
60
pkgs/servers/prowlarr/default.nix
Normal file
60
pkgs/servers/prowlarr/default.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, makeWrapper, icu, dotnetCorePackages, openssl, nixosTests }:
|
||||
|
||||
let
|
||||
os =
|
||||
if stdenv.isDarwin then
|
||||
"osx"
|
||||
else if stdenv.isLinux then
|
||||
"linux"
|
||||
else
|
||||
throw "Not supported on ${stdenv.hostPlatform.system}.";
|
||||
|
||||
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-9DoqyotXAUha2TMSgDIot5PD8ABpfZ8gsshS1ypr5SY=";
|
||||
arm64-linux_hash = "sha256-r22c70OuevRsF8gOHZOkkhlRtoD4nsTHnXF82elQIF8=";
|
||||
x64-osx_hash = "sha256-6jVM4iSGT7tpagocI/1nuBPVvAegfFqsCfrz2fPKCI4=";
|
||||
}."${arch}-${os}_hash";
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "prowlarr";
|
||||
version = "0.1.1.978";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/Prowlarr/Prowlarr/releases/download/v${version}/Prowlarr.develop.${version}.${os}-core-${arch}.tar.gz";
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{bin,share/${pname}-${version}}
|
||||
cp -r * $out/share/${pname}-${version}/.
|
||||
|
||||
makeWrapper "${dotnetCorePackages.netcore_3_1}/bin/dotnet" $out/bin/Prowlarr \
|
||||
--add-flags "$out/share/${pname}-${version}/Prowlarr.dll" \
|
||||
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
|
||||
curl sqlite libmediainfo mono openssl icu ]}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "An indexer manager/proxy built on the popular arr .net/reactjs base stack";
|
||||
homepage = "https://wiki.servarr.com/prowlarr";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ jdreaver ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
50
pkgs/servers/prowlarr/update.sh
Executable file
50
pkgs/servers/prowlarr/update.sh
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnused nix-prefetch jq
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
dirname="$(dirname "$0")"
|
||||
|
||||
updateHash()
|
||||
{
|
||||
version=$1
|
||||
arch=$2
|
||||
os=$3
|
||||
|
||||
hashKey="${arch}-${os}_hash"
|
||||
|
||||
url="https://github.com/Prowlarr/Prowlarr/releases/download/v$version/Prowlarr.develop.$version.$os-core-$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 ../../.. prowlarr.version)
|
||||
|
||||
# N.B. Prowlarr is still in development, so
|
||||
# https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest
|
||||
# returns nothing. Once this endpoint returns something, we should use
|
||||
# it. Until then, we use jq to sort releases (N.B. the "sort_by(. |
|
||||
# split(".") | map(tonumber))" incantation is to sort the version
|
||||
# number properly and not as a string).
|
||||
|
||||
# latestTag=$(curl https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest | jq -r ".tag_name")
|
||||
# latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
||||
latestVersion=$(curl https://api.github.com/repos/Prowlarr/Prowlarr/git/refs/tags | jq '. | map(.ref | sub("refs/tags/v";"")) | sort_by(. | split(".") | map(tonumber)) | .[-1]' -r)
|
||||
|
||||
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "Prowlarr is up-to-date: ${currentVersion}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
updateVersion $latestVersion
|
||||
|
||||
updateHash $latestVersion x64 linux
|
||||
updateHash $latestVersion arm64 linux
|
||||
updateHash $latestVersion x64 osx
|
|
@ -8633,6 +8633,8 @@ with pkgs;
|
|||
|
||||
openmodelica = recurseIntoAttrs (callPackage ../applications/science/misc/openmodelica {});
|
||||
|
||||
prowlarr = callPackage ../servers/prowlarr { };
|
||||
|
||||
qarte = libsForQt5.callPackage ../applications/video/qarte { };
|
||||
|
||||
qlcplus = libsForQt5.callPackage ../applications/misc/qlcplus { };
|
||||
|
|
Loading…
Reference in a new issue