diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 67259dd64034..47b77d66873c 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -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";
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
index 1e732be031e1..a7d381ee11c0 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
@@ -269,6 +269,14 @@
postfixadmin.
+
+
+ prowlarr,
+ an indexer manager/proxy built on the popular arr .net/reactjs
+ base stack
+ services.prowlarr.
+
+
soju, a
diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md
index 3abd869d672a..4c6c33901479 100644
--- a/nixos/doc/manual/release-notes/rl-2111.section.md
+++ b/nixos/doc/manual/release-notes/rl-2111.section.md
@@ -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).
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 19cb2ddb8b2a..92e411a42cfe 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -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
diff --git a/nixos/modules/services/misc/prowlarr.nix b/nixos/modules/services/misc/prowlarr.nix
new file mode 100644
index 000000000000..ef820b4022d5
--- /dev/null
+++ b/nixos/modules/services/misc/prowlarr.nix
@@ -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 ];
+ };
+ };
+}
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 1c44030eaab2..a6eb2c032588 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -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 {};
diff --git a/nixos/tests/prowlarr.nix b/nixos/tests/prowlarr.nix
new file mode 100644
index 000000000000..4cbca107568f
--- /dev/null
+++ b/nixos/tests/prowlarr.nix
@@ -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/")
+ '';
+})
diff --git a/pkgs/servers/prowlarr/default.nix b/pkgs/servers/prowlarr/default.nix
new file mode 100644
index 000000000000..511217a48f18
--- /dev/null
+++ b/pkgs/servers/prowlarr/default.nix
@@ -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" ];
+ };
+}
diff --git a/pkgs/servers/prowlarr/update.sh b/pkgs/servers/prowlarr/update.sh
new file mode 100755
index 000000000000..d61edda5a0a3
--- /dev/null
+++ b/pkgs/servers/prowlarr/update.sh
@@ -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
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e74bfca22804..0659c008c36b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -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 { };