rsshub: init at 0-unstable-2024-07-08

Co-authored-by: Aleksana <alexander.huang.y@gmail.com>

+116
+30
pkgs/by-name/rs/rsshub/0001-fix-git-hash.patch
···
··· 1 + From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 + From: Guanran Wang <guanran928@outlook.com> 3 + Date: Tue, 9 Jul 2024 16:49:41 +0800 4 + Subject: [PATCH] fix git hash 5 + 6 + --- 7 + lib/utils/git-hash.ts | 12 ++---------- 8 + 1 file changed, 2 insertions(+), 10 deletions(-) 9 + 10 + diff --git a/lib/utils/git-hash.ts b/lib/utils/git-hash.ts 11 + index 9a8131696..f1f568fb4 100644 12 + --- a/lib/utils/git-hash.ts 13 + +++ b/lib/utils/git-hash.ts 14 + @@ -1,14 +1,6 @@ 15 + import { execSync } from 'child_process'; 16 + 17 + -let gitHash = process.env.HEROKU_SLUG_COMMIT?.slice(0, 8) || process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 8); 18 + -let gitDate: Date | undefined; 19 + -if (!gitHash) { 20 + - try { 21 + - gitHash = execSync('git rev-parse HEAD').toString().trim().slice(0, 8); 22 + - gitDate = new Date(execSync('git log -1 --format=%cd').toString().trim()); 23 + - } catch { 24 + - gitHash = 'unknown'; 25 + - } 26 + -} 27 + +let gitHash = '@GIT_HASH@'.slice(0, 8); 28 + +let gitDate = new Date('Thu Jan 1 00:00:00 1970 +0000'); 29 + 30 + export { gitHash, gitDate };
+86
pkgs/by-name/rs/rsshub/package.nix
···
··· 1 + { 2 + lib, 3 + fetchFromGitHub, 4 + makeBinaryWrapper, 5 + nodejs, 6 + pnpm, 7 + stdenv, 8 + substitute, 9 + }: 10 + stdenv.mkDerivation (finalAttrs: { 11 + pname = "rsshub"; 12 + version = "0-unstable-2024-07-08"; 13 + 14 + src = fetchFromGitHub { 15 + owner = "DIYgod"; 16 + repo = "RSSHub"; 17 + rev = "6a29ca395191e745f991b9a0643a2fa9a66c8730"; 18 + hash = "sha256-K7qNPF1vdqhNEjWcysnj20Qaltu3rnhi1bVnIEOTiuk="; 19 + }; 20 + 21 + patches = [ 22 + (substitute { 23 + src = ./0001-fix-git-hash.patch; 24 + substitutions = [ 25 + "--subst-var-by" 26 + "GIT_HASH" 27 + finalAttrs.src.rev 28 + ]; 29 + }) 30 + ]; 31 + 32 + pnpmDeps = pnpm.fetchDeps { 33 + inherit (finalAttrs) pname version src; 34 + hash = "sha256-1Djef4QRLiEKr6ERtL0/IQSYp9dMq3cOCHPW4QnfaZU="; 35 + }; 36 + 37 + nativeBuildInputs = [ 38 + makeBinaryWrapper 39 + nodejs 40 + pnpm.configHook 41 + ]; 42 + 43 + buildPhase = '' 44 + runHook preBuild 45 + 46 + pnpm build 47 + 48 + runHook postBuild 49 + ''; 50 + 51 + installPhase = '' 52 + runHook preInstall 53 + 54 + mkdir -p $out/bin $out/lib/rsshub 55 + cp -r lib node_modules assets api package.json tsconfig.json $out/lib/rsshub 56 + 57 + runHook postInstall 58 + ''; 59 + 60 + preFixup = '' 61 + makeWrapper ${lib.getExe nodejs} $out/bin/rsshub \ 62 + --chdir "$out/lib/rsshub" \ 63 + --set "NODE_ENV" "production" \ 64 + --set "NO_LOGFILES" "true" \ 65 + --set "TSX_TSCONFIG_PATH" "$out/lib/rsshub/tsconfig.json" \ 66 + --append-flags "$out/lib/rsshub/node_modules/tsx/dist/cli.mjs" \ 67 + --append-flags "$out/lib/rsshub/lib/index.ts" 68 + ''; 69 + 70 + meta = { 71 + description = "RSS feed generator"; 72 + longDescription = '' 73 + RSSHub is an open source, easy to use, and extensible RSS feed generator. 74 + It's capable of generating RSS feeds from pretty much everything. 75 + 76 + RSSHub delivers millions of contents aggregated from all kinds of sources, 77 + our vibrant open source community is ensuring the deliver of RSSHub's new routes, 78 + new features and bug fixes. 79 + ''; 80 + homepage = "https://docs.rsshub.app"; 81 + license = lib.licenses.mit; 82 + maintainers = with lib.maintainers; [ Guanran928 ]; 83 + mainProgram = "rsshub"; 84 + platforms = lib.platforms.all; 85 + }; 86 + })