From 75cf64a10bf2e443bbd13d119d9c2e56950ef75f Mon Sep 17 00:00:00 2001 From: eljamm Date: Mon, 2 Feb 2026 14:45:17 +0100 Subject: [PATCH] peertube: 7.3.0 -> 8.0.2; add ngi team Diff: https://github.com/Chocobozzz/PeerTube/compare/v7.3.0...v8.0.2 --- doc/release-notes/rl-2605.section.md | 4 + pkgs/by-name/pe/peertube/package.nix | 169 ++++++++++----------------- 2 files changed, 64 insertions(+), 109 deletions(-) diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index 6e12a6b46674..df102a30a01a 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -88,6 +88,10 @@ - `python3Packages.pygame` has been been renamed to `python3Packages.pygame-original`, the attribute `python3Packages.pygame` will from python 3.14 default to the more actively maintained `python3Packages.pygame-ce` +- `peertube` has been updated from `7.3.0` to `8.0.2`, introducing several breaking changes. + Some notable new features include channel collaboration and video player redesign with a new theme. + For details on how to upgrade, see the `IMPORTANT NOTES` section of the [v8.0.0 CHANGELOG entry](https://docs.joinpeertube.org/CHANGELOG#v8-0-0). + - `python3Packages.gradio` has been updated to version 6. See upstream's migration guide at https://www.gradio.app/main/guides/gradio-6-migration-guide. - `vicinae` has been updated to v0.17. Version 0.17 contains a complete overhaul of the configuration system. For update instructions, see the [release notes for v0.17.0](https://github.com/vicinaehq/vicinae/releases/tag/v0.17.0) and the [upstream configuration documentation](https://docs.vicinae.com/config). diff --git a/pkgs/by-name/pe/peertube/package.nix b/pkgs/by-name/pe/peertube/package.nix index 58c4142829c6..7399c0ef32cb 100644 --- a/pkgs/by-name/pe/peertube/package.nix +++ b/pkgs/by-name/pe/peertube/package.nix @@ -1,79 +1,33 @@ { lib, stdenv, - fetchurl, fetchFromGitHub, - fetchYarnDeps, - nixosTests, + fetchPnpmDeps, + + # build brotli, - fixup-yarn-lock, - jq, + dart-sass, fd, - nodejs_20, + jq, + pnpmConfigHook, + pnpm_10, which, - yarn, + + # runtime + nodejs_20, + + # tests + nixosTests, }: -let - bcryptHostPlatformAttrs = { - x86_64-linux = { - arch = "linux-x64"; - libc = "glibc"; - hash = "sha256-C5N6VgFtXPLLjZt0ZdRTX095njRIT+12ONuUaBBj7fQ="; - }; - aarch64-linux = { - arch = "linux-arm64"; - libc = "glibc"; - hash = "sha256-TerDujO+IkSRnHYlSbAKSP9IS7AT7XnQJsZ8D8pCoGc="; - }; - x86_64-darwin = { - arch = "darwin-x64"; - libc = "unknown"; - hash = "sha256-gphOONWujbeCCr6dkmMRJP94Dhp1Jvp2yt+g7n1HTv0="; - }; - aarch64-darwin = { - arch = "darwin-arm64"; - libc = "unknown"; - hash = "sha256-JMnELVUxoU1C57Tzue3Sg6OfDFAjfCnzgDit0BWzmlo="; - }; - }; - bcryptAttrs = - bcryptHostPlatformAttrs."${stdenv.hostPlatform.system}" - or (throw "Unsupported architecture: ${stdenv.hostPlatform.system}"); - bcryptVersion = "5.1.1"; - bcryptLib = fetchurl { - url = "https://github.com/kelektiv/node.bcrypt.js/releases/download/v${bcryptVersion}/bcrypt_lib-v${bcryptVersion}-napi-v3-${bcryptAttrs.arch}-${bcryptAttrs.libc}.tar.gz"; - inherit (bcryptAttrs) hash; - }; -in stdenv.mkDerivation (finalAttrs: { pname = "peertube"; - version = "7.3.0"; + version = "8.0.2"; src = fetchFromGitHub { owner = "Chocobozzz"; repo = "PeerTube"; tag = "v${finalAttrs.version}"; - hash = "sha256-WbZFOOvX6WzKB9tszxJl6z+V6cDBH6Y2SjoxF17WvUo="; - }; - - yarnOfflineCacheServer = fetchYarnDeps { - yarnLock = "${finalAttrs.src}/yarn.lock"; - hash = "sha256-T1stKz8+1ghQBJB8kujwcqmygMdoswjFBL/QWAHSis0="; - }; - - yarnOfflineCacheClient = fetchYarnDeps { - yarnLock = "${finalAttrs.src}/client/yarn.lock"; - hash = "sha256-jeE6Xpi/A1Ldbbp12rkG19auud61AZna/vbVE2mpp/8="; - }; - - yarnOfflineCacheAppsCli = fetchYarnDeps { - yarnLock = "${finalAttrs.src}/apps/peertube-cli/yarn.lock"; - hash = "sha256-lcWtZGE/6XGm8KXmzSowCHAb/vGwBoqkwk32Ru3mMYU="; - }; - - yarnOfflineCacheAppsRunner = fetchYarnDeps { - yarnLock = "${finalAttrs.src}/apps/peertube-runner/yarn.lock"; - hash = "sha256-OX9em03iqaRCqFuo2QO/r+CBdk7hHk3WY1EBXlFr1cY="; + hash = "sha256-u4LDk9r88h3EqX6ZRMPCQmjOvfJDXwV2YYrKEkGBWgs="; }; outputs = [ @@ -82,55 +36,40 @@ stdenv.mkDerivation (finalAttrs: { "runner" ]; + pnpmDeps = fetchPnpmDeps { + inherit (finalAttrs) pname version src; + pnpm = pnpm_10; + fetcherVersion = 3; + hash = "sha256-1CmfcDZ23oITP8GQGIBeZP4Z5AON0f3CtdHGnpZxHgQ="; + }; + nativeBuildInputs = [ brotli - fixup-yarn-lock - jq - which - yarn fd + jq + pnpmConfigHook + pnpm_10 + which ]; - buildInputs = [ nodejs_20 ]; + buildInputs = [ + nodejs_20 + ]; + + preBuild = '' + # force sass-embedded to use our own sass instead of the bundled one + for dep in node_modules/.pnpm/sass-embedded@*; do + substituteInPlace $dep/node_modules/sass-embedded/dist/lib/src/compiler-path.js \ + --replace-fail \ + 'compilerCommand = (() => {' \ + 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];' + done + ''; buildPhase = '' - # Build node modules + runHook preBuild + export HOME=$PWD - fixup-yarn-lock ~/yarn.lock - fixup-yarn-lock ~/client/yarn.lock - fixup-yarn-lock ~/apps/peertube-cli/yarn.lock - fixup-yarn-lock ~/apps/peertube-runner/yarn.lock - yarn config --offline set yarn-offline-mirror $yarnOfflineCacheServer - yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress - cd ~/client - yarn config --offline set yarn-offline-mirror $yarnOfflineCacheClient - yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress - - # Switch sass-embedded to sass - find node_modules/vite/dist -name "*.js" -type f -exec grep -l "sass-embedded" {} \; | while read file; do - echo "Patching $file" - sed -i 's/"sass-embedded"/"sass"/g; s/'"'"'sass-embedded'"'"'/'"'"'sass'"'"'/g' "$file" - done - - cd ~/apps/peertube-cli - yarn config --offline set yarn-offline-mirror $yarnOfflineCacheAppsCli - yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress - cd ~/apps/peertube-runner - yarn config --offline set yarn-offline-mirror $yarnOfflineCacheAppsRunner - yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress - - patchShebangs ~/{node_modules,client/node_modules,/apps/peertube-cli/node_modules,apps/peertube-runner/node_modules,scripts} - - # Fix bcrypt node module - cd ~/node_modules/bcrypt - if [ "${bcryptVersion}" != "$(cat package.json | jq -r .version)" ]; then - echo "Mismatching version please update bcrypt in derivation" - exit - fi - mkdir -p ./lib/binding && tar -C ./lib/binding -xf ${bcryptLib} - - # Return to home directory - cd ~ # Build PeerTube server npm run build:server @@ -147,7 +86,8 @@ stdenv.mkDerivation (finalAttrs: { patchShebangs ~/apps/peertube-runner/dist/peertube-runner.js # Clean up declaration files - find ~/dist/ \ + find \ + ~/dist/ \ ~/packages/core-utils/dist/ \ ~/packages/ffmpeg/dist/ \ ~/packages/models/dist/ \ @@ -156,14 +96,20 @@ stdenv.mkDerivation (finalAttrs: { ~/packages/transcription/dist/ \ ~/packages/typescript-utils/dist/ \ \( -name '*.d.ts' -o -name '*.d.ts.map' \) -type f -delete + + runHook postBuild ''; installPhase = '' + runHook preInstall + mkdir -p $out/dist mv ~/dist $out mv ~/node_modules $out/node_modules + mkdir $out/client - mv ~/client/{dist,node_modules,package.json,yarn.lock} $out/client + mv ~/client/{dist,node_modules,package.json} $out/client + mkdir -p $out/packages/{core-utils,ffmpeg,models,node-utils,server-commands,transcription,typescript-utils} mv ~/packages/core-utils/{dist,package.json} $out/packages/core-utils mv ~/packages/ffmpeg/{dist,package.json} $out/packages/ffmpeg @@ -172,22 +118,22 @@ stdenv.mkDerivation (finalAttrs: { mv ~/packages/server-commands/{dist,package.json} $out/packages/server-commands mv ~/packages/transcription/{dist,package.json} $out/packages/transcription mv ~/packages/typescript-utils/{dist,package.json} $out/packages/typescript-utils - mv ~/{config,support,CREDITS.md,FAQ.md,LICENSE,README.md,package.json,yarn.lock} $out + mv ~/{config,support,CREDITS.md,FAQ.md,LICENSE,README.md,package.json,pnpm-lock.yaml} $out # Remove broken symlinks in node_modules from workspace packages that aren't needed # by the built artifact. If any new packages break the check for broken symlinks, # they should be checked before adding them here to make sure they aren't likely to # be needed, either now or in the future. If they might be, then we probably want # to move the package to $out above instead of removing the broken symlink. - rm $out/node_modules/@peertube/{peertube-server,peertube-transcription-devtools,peertube-types-generator,tests} - rm $out/client/node_modules/@peertube/{peertube-transcription-devtools,peertube-types-generator,tests,player} + rm $out/node_modules/.pnpm/node_modules/@peertube/{peertube-cli,peertube-runner,peertube-server,peertube-transcription-devtools,peertube-types-generator,tests,player} + rm $out/client/node_modules/@peertube/player mkdir -p $cli/bin - mv ~/apps/peertube-cli/{dist,node_modules,package.json,yarn.lock} $cli + mv ~/apps/peertube-cli/{dist,node_modules,package.json} $cli ln -s $cli/dist/peertube.js $cli/bin/peertube-cli mkdir -p $runner/bin - mv ~/apps/peertube-runner/{dist,node_modules,package.json,yarn.lock} $runner + mv ~/apps/peertube-runner/{dist,node_modules,package.json} $runner ln -s $runner/dist/peertube-runner.js $runner/bin/peertube-runner # Create static gzip and brotli files @@ -195,6 +141,8 @@ stdenv.mkDerivation (finalAttrs: { --type file --search-path $out/client/dist --threads $NIX_BUILD_CORES \ --exec gzip -9 -n -c {} > {}.gz \;\ --exec brotli --best -f {} -o {}.br + + runHook postInstall ''; passthru.tests.peertube = nixosTests.peertube; @@ -228,5 +176,8 @@ stdenv.mkDerivation (finalAttrs: { izorkin stevenroose ]; + teams = with lib.teams; [ + ngi + ]; }; })