lol

whisparr: init at 2.0.0.548 + nixos/whisparr: initial commit (#244172)

authored by

Arne Keller and committed by
GitHub
e89a8d56 99065afd

+249
+2
nixos/doc/manual/release-notes/rl-2411.section.md
··· 95 95 96 96 - [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr), a proxy server to bypass Cloudflare protection. Available as [services.flaresolverr](#opt-services.flaresolverr.enable). 97 97 98 + - [Whisparr](https://wiki.servarr.com/en/whisparr), an adult movie collection manager for Usenet and BitTorrent users. Available as [services.whisparr](#opt-services.whisparr.enable). 99 + 98 100 - [Gancio](https://gancio.org/), a shared agenda for local communities. Available as [services.gancio](#opt-services.gancio.enable). 99 101 100 102 - [Goatcounter](https://www.goatcounter.com/), an easy web analytics platform with no tracking of personal data. Available as [services.goatcounter](options.html#opt-services.goatcounter.enable).
+2
nixos/modules/misc/ids.nix
··· 355 355 rstudio-server = 324; 356 356 localtimed = 325; 357 357 automatic-timezoned = 326; 358 + whisparr = 328; 358 359 359 360 # When adding a uid, make sure it doesn't match an existing gid. 360 361 # ··· 683 684 localtimed = 325; 684 685 automatic-timezoned = 326; 685 686 uinput = 327; 687 + whisparr = 328; 686 688 687 689 # When adding a gid, make sure it doesn't match an existing 688 690 # uid. Users and groups with the same name should have equal
+1
nixos/modules/module-list.nix
··· 886 886 ./services/misc/wastebin.nix 887 887 ./services/misc/weechat.nix 888 888 ./services/misc/workout-tracker.nix 889 + ./services/misc/whisparr.nix 889 890 ./services/misc/xmrig.nix 890 891 ./services/misc/zoneminder.nix 891 892 ./services/misc/zookeeper.nix
+73
nixos/modules/services/misc/whisparr.nix
··· 1 + { 2 + config, 3 + pkgs, 4 + lib, 5 + ... 6 + }: 7 + 8 + let 9 + cfg = config.services.whisparr; 10 + in 11 + { 12 + options = { 13 + services.whisparr = { 14 + enable = lib.mkEnableOption "Whisparr"; 15 + 16 + package = lib.mkPackageOption pkgs "whisparr" { }; 17 + 18 + dataDir = lib.mkOption { 19 + type = lib.types.path; 20 + default = "/var/lib/whisparr/.config/Whisparr"; 21 + description = "The directory where Whisparr stores its data files."; 22 + }; 23 + 24 + openFirewall = lib.mkOption { 25 + type = lib.types.bool; 26 + default = false; 27 + description = "Open ports in the firewall for the Whisparr web interface."; 28 + }; 29 + 30 + user = lib.mkOption { 31 + type = lib.types.str; 32 + default = "whisparr"; 33 + description = "User account under which Whisparr runs."; 34 + }; 35 + 36 + group = lib.mkOption { 37 + type = lib.types.str; 38 + default = "whisparr"; 39 + description = "Group under which Whisparr runs."; 40 + }; 41 + }; 42 + }; 43 + 44 + config = lib.mkIf cfg.enable { 45 + systemd.tmpfiles.rules = [ "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -" ]; 46 + 47 + systemd.services.whisparr = { 48 + description = "Whisparr"; 49 + after = [ "network.target" ]; 50 + wantedBy = [ "multi-user.target" ]; 51 + 52 + serviceConfig = { 53 + Type = "simple"; 54 + User = cfg.user; 55 + Group = cfg.group; 56 + ExecStart = "${lib.getExe cfg.package} -nobrowser -data='${cfg.dataDir}'"; 57 + Restart = "on-failure"; 58 + }; 59 + }; 60 + 61 + networking.firewall = lib.mkIf cfg.openFirewall { allowedTCPPorts = [ 6969 ]; }; 62 + 63 + users.users = lib.mkIf (cfg.user == "whisparr") { 64 + whisparr = { 65 + group = cfg.group; 66 + home = cfg.dataDir; 67 + uid = config.ids.uids.whisparr; 68 + }; 69 + }; 70 + 71 + users.groups = lib.mkIf (cfg.group == "whisparr") { whisparr.gid = config.ids.gids.whisparr; }; 72 + }; 73 + }
+1
nixos/tests/all-tests.nix
··· 1148 1148 watchdogd = handleTest ./watchdogd.nix {}; 1149 1149 webhook = runTest ./webhook.nix; 1150 1150 weblate = handleTest ./web-apps/weblate.nix {}; 1151 + whisparr = handleTest ./whisparr.nix {}; 1151 1152 wiki-js = handleTest ./wiki-js.nix {}; 1152 1153 wine = handleTest ./wine.nix {}; 1153 1154 wireguard = handleTest ./wireguard {};
+19
nixos/tests/whisparr.nix
··· 1 + import ./make-test-python.nix ( 2 + { lib, ... }: 3 + { 4 + name = "whisparr"; 5 + meta.maintainers = [ lib.maintainers.paveloom ]; 6 + 7 + nodes.machine = 8 + { pkgs, ... }: 9 + { 10 + services.whisparr.enable = true; 11 + }; 12 + 13 + testScript = '' 14 + machine.wait_for_unit("whisparr.service") 15 + machine.wait_for_open_port(6969) 16 + machine.succeed("curl --fail http://localhost:6969/") 17 + ''; 18 + } 19 + )
+96
pkgs/by-name/wh/whisparr/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + 5 + curl, 6 + dotnet-runtime, 7 + fetchurl, 8 + icu, 9 + libmediainfo, 10 + makeWrapper, 11 + mono, 12 + openssl, 13 + sqlite, 14 + zlib, 15 + 16 + nixosTests, 17 + }: 18 + 19 + let 20 + os = if stdenv.hostPlatform.isDarwin then "osx" else "linux"; 21 + system = stdenv.hostPlatform.system; 22 + arch = 23 + { 24 + aarch64-darwin = "arm64"; 25 + aarch64-linux = "arm64"; 26 + x86_64-darwin = "x64"; 27 + x86_64-linux = "x64"; 28 + } 29 + ."${system}" or (throw "Unsupported system: ${system}"); 30 + hash = 31 + { 32 + arm64-linux-hash = "sha256-s0j3ZYqS0fp8yLxPXP25BvLzLt7Uisl2c+94saMWEMw="; 33 + arm64-osx-hash = "sha256-vHUtrMHJ1g7ltGuf765/IVDAWfanSUGRQbVnzsuTgrQ="; 34 + x64-linux-hash = "sha256-mYLDQxAS6WV8CWzG1gSjPl37SJaVoLV21Meh1cRk45w="; 35 + x64-osx-hash = "sha256-YNUb5eOc0iMOjZ9vbYLodFp5jlqk1OcOyRi10REyVX4="; 36 + } 37 + ."${arch}-${os}-hash"; 38 + in 39 + stdenv.mkDerivation rec { 40 + pname = "whisparr"; 41 + version = "2.0.0.548"; 42 + 43 + src = fetchurl { 44 + name = "${pname}-${arch}-${os}-${version}.tar.gz"; 45 + url = "https://whisparr.servarr.com/v1/update/nightly/updatefile?runtime=netcore&version=${version}&arch=${arch}&os=${os}"; 46 + inherit hash; 47 + }; 48 + 49 + nativeBuildInputs = [ makeWrapper ]; 50 + 51 + runtimeLibs = lib.makeLibraryPath [ 52 + curl 53 + icu 54 + libmediainfo 55 + mono 56 + openssl 57 + sqlite 58 + zlib 59 + ]; 60 + 61 + installPhase = '' 62 + runHook preInstall 63 + 64 + rm -rf "Whisparr.Update" 65 + 66 + mkdir -p $out/{bin,share/${pname}-${version}} 67 + cp -r * $out/share/${pname}-${version}/ 68 + 69 + makeWrapper "${dotnet-runtime}/bin/dotnet" $out/bin/Whisparr \ 70 + --add-flags "$out/share/${pname}-${version}/Whisparr.dll" \ 71 + --prefix LD_LIBRARY_PATH : ${runtimeLibs} 72 + 73 + runHook postInstall 74 + ''; 75 + 76 + passthru = { 77 + updateScript = ./update.sh; 78 + tests.smoke-test = nixosTests.whisparr; 79 + }; 80 + 81 + meta = { 82 + description = "Adult movie collection manager for Usenet and BitTorrent users"; 83 + homepage = "https://wiki.servarr.com/en/whisparr"; 84 + changelog = "https://whisparr.servarr.com/v1/update/nightly/changes"; 85 + license = lib.licenses.gpl3Only; 86 + platforms = [ 87 + "aarch64-darwin" 88 + "aarch64-linux" 89 + "x86_64-darwin" 90 + "x86_64-linux" 91 + ]; 92 + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; 93 + mainProgram = "Whisparr"; 94 + maintainers = [ lib.maintainers.paveloom ]; 95 + }; 96 + }
+55
pkgs/by-name/wh/whisparr/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl gnused jq nix-prefetch 3 + #shellcheck shell=bash 4 + 5 + set -e 6 + 7 + dirname="$(dirname "$0")" 8 + 9 + updateVersion() { 10 + version=$1 11 + echo "Updating the version..." 12 + sed -i "s#version = \"[0-9.]*\"#version = \"$version\"#" "$dirname/package.nix" 13 + } 14 + 15 + updateHash() 16 + { 17 + version=$1 18 + arch=$2 19 + os=$3 20 + 21 + system="${arch}-${os}" 22 + hashKey="${system}-hash" 23 + 24 + echo "Updating the hash for the \`${system}\` system..." 25 + url="https://whisparr.servarr.com/v1/update/nightly/updatefile?runtime=netcore&version=${version}&arch=${arch}&os=${os}" 26 + hash=$(nix-prefetch-url --type sha256 --name "whisparr-$system-$version.tar.gz" "$url") 27 + sriHash="$(nix hash to-sri --type sha256 "$hash")" 28 + 29 + sed -i "s#$hashKey = \"[a-zA-Z0-9\/+-=]*\"#$hashKey = \"$sriHash\"#" "$dirname/package.nix" 30 + } 31 + 32 + echo "Checking for updates of Whisparr..." 33 + 34 + currentVersion=$(nix eval --raw -f "$dirname"/../../../.. whisparr.version) 35 + echo "Current version: \`$currentVersion\`." 36 + 37 + echo "Fetching the latest version..." 38 + latestVersion=$( 39 + curl -s "https://whisparr.servarr.com/v1/update/nightly/changes?runtime=netcore&os=linux" | 40 + jq -r .[0].version 41 + ) 42 + 43 + if [[ "$currentVersion" == "$latestVersion" ]]; then 44 + echo "Whisparr is up-to-date." 45 + exit 0 46 + else 47 + echo "New version is available: \`$latestVersion\`." 48 + fi 49 + 50 + updateHash "$latestVersion" arm64 linux 51 + updateHash "$latestVersion" arm64 osx 52 + updateHash "$latestVersion" x64 linux 53 + updateHash "$latestVersion" x64 osx 54 + 55 + updateVersion "$latestVersion"