Merge pull request #136039 from jdreaver/prowlarr

This commit is contained in:
Martin Weinelt 2021-10-10 23:30:57 +02:00 committed by GitHub
commit f358794824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 190 additions and 0 deletions

View File

@ -5144,6 +5144,12 @@
githubId = 117874;
name = "Jeroen de Haas";
};
jdreaver = {
email = "johndreaver@gmail.com";
github = "jdreaver";
githubId = 1253071;
name = "David Reaver";
};
jduan = {
name = "Jingjing Duan";
email = "duanjingjing@gmail.com";

View File

@ -269,6 +269,14 @@
<link linkend="opt-services.postfixadmin.enable">postfixadmin</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://wiki.servarr.com/prowlarr">prowlarr</link>,
an indexer manager/proxy built on the popular arr .net/reactjs
base stack
<link linkend="opt-services.prowlarr.enable">services.prowlarr</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://sr.ht/~emersion/soju">soju</link>, a

View File

@ -82,6 +82,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- [postfixadmin](https://postfixadmin.sourceforge.io/), a web based virtual user administration interface for Postfix mail servers. Available as [postfixadmin](#opt-services.postfixadmin.enable).
- [prowlarr](https://wiki.servarr.com/prowlarr), an indexer manager/proxy built on the popular arr .net/reactjs base stack [services.prowlarr](#opt-services.prowlarr.enable).
- [soju](https://sr.ht/~emersion/soju), a user-friendly IRC bouncer. Available as [services.soju](options.html#opt-services.soju.enable).
- [nats](https://nats.io/), a high performance cloud and edge messaging system. Available as [services.nats](#opt-services.nats.enable).

View File

@ -571,6 +571,7 @@
./services/misc/plex.nix
./services/misc/plikd.nix
./services/misc/podgrab.nix
./services/misc/prowlarr.nix
./services/misc/tautulli.nix
./services/misc/pinnwand.nix
./services/misc/pykms.nix

View File

@ -0,0 +1,41 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.prowlarr;
in
{
options = {
services.prowlarr = {
enable = mkEnableOption "Prowlarr";
openFirewall = mkOption {
type = types.bool;
default = false;
description = "Open ports in the firewall for the Prowlarr web interface.";
};
};
};
config = mkIf cfg.enable {
systemd.services.prowlarr = {
description = "Prowlarr";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
DynamicUser = true;
StateDirectory = "prowlarr";
ExecStart = "${pkgs.prowlarr}/bin/Prowlarr -nobrowser -data=/var/lib/prowlarr";
Restart = "on-failure";
};
};
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ 9696 ];
};
};
}

View File

@ -375,6 +375,7 @@ in
prosody = handleTest ./xmpp/prosody.nix {};
prosodyMysql = handleTest ./xmpp/prosody-mysql.nix {};
proxy = handleTest ./proxy.nix {};
prowlarr = handleTest ./prowlarr.nix {};
pt2-clone = handleTest ./pt2-clone.nix {};
qboot = handleTestOn ["x86_64-linux" "i686-linux"] ./qboot.nix {};
quorum = handleTest ./quorum.nix {};

18
nixos/tests/prowlarr.nix Normal file
View File

@ -0,0 +1,18 @@
import ./make-test-python.nix ({ lib, ... }:
with lib;
{
name = "prowlarr";
meta.maintainers = with maintainers; [ jdreaver ];
nodes.machine =
{ pkgs, ... }:
{ services.prowlarr.enable = true; };
testScript = ''
machine.wait_for_unit("prowlarr.service")
machine.wait_for_open_port("9696")
machine.succeed("curl --fail http://localhost:9696/")
'';
})

View File

@ -0,0 +1,61 @@
{ 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;
tests.smoke-test = nixosTests.prowlarr;
};
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
View 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

View File

@ -8643,6 +8643,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 { };