22 lib ,
33 fetchFromGitHub ,
44 makeBinaryWrapper ,
5+ nix-update-script ,
56 nodejs ,
6- pnpm_9 ,
7+ pnpm ,
78 fetchPnpmDeps ,
89 pnpmConfigHook ,
910 replaceVars ,
1011 stdenv ,
11- nix-update-script ,
1212} :
1313stdenv . mkDerivation ( finalAttrs : {
1414 pname = "rsshub" ;
15- version = "0-unstable-2025-11 -28" ;
15+ version = "0-unstable-2026-02 -28" ;
1616
1717 src = fetchFromGitHub {
1818 owner = "DIYgod" ;
1919 repo = "RSSHub" ;
20- rev = "b6dbafe33e0c3e3a4ba5a1edd2da29b70412389f " ;
21- hash = "sha256-FsevO2nb6leuuRmzCLIy093FCafl3Y/CsSp1ydJOnKY =" ;
20+ rev = "1acb8057995a446574827b6e3e756de462e8f6be " ;
21+ hash = "sha256-I89mEL93rktDZdeSCQp6N6JCp7k93jvKS74ALXz6GUs =" ;
2222 } ;
2323
2424 patches = [
2525 ( replaceVars ./0001-fix-git-hash.patch {
26- " GIT_HASH" = finalAttrs . src . rev ;
26+ GIT_HASH = finalAttrs . src . rev ;
2727 } )
28- ./0002-fix-network-call.patch
2928 ] ;
3029
3130 pnpmDeps = fetchPnpmDeps {
3231 inherit ( finalAttrs ) pname version src ;
33- pnpm = pnpm_9 ;
34- fetcherVersion = 1 ;
35- hash = "sha256-zTsJZnhX7xUOsKST6S3TQUV8M1Tewcs9fZgrDSf5ba8=" ;
32+ fetcherVersion = 3 ;
33+ hash = "sha256-/Rc8yb0To9rNs5XavFBjEImMk32/zFX03RHvI+Uj4gc=" ;
3634 } ;
3735
3836 nativeBuildInputs = [
3937 makeBinaryWrapper
4038 nodejs
4139 pnpmConfigHook
42- pnpm_9
40+ pnpm
4341 ] ;
4442
43+ # Patch lib/registry.ts to add a BUILD_ROUTES_MODE branch that uses
44+ # directoryImport to collect route metadata without executing module-level
45+ # code, which would fail in the network-isolated Nix sandbox.
46+ # See: https://github.com/DIYgod/RSSHub/blob/master/flake.nix
47+ postPatch = ''
48+ substituteInPlace lib/registry.ts \
49+ --replace-fail 'if (config.isPackage)' \
50+ 'if (process.env.BUILD_ROUTES_MODE) {
51+ modules = directoryImport({
52+ targetDirectoryPath: path.join(__dirname, "./routes"),
53+ importPattern: /\.tsx?$/,
54+ }) as typeof modules;
55+ } else if (config.isPackage)'
56+ '' ;
57+
4558 buildPhase = ''
4659 runHook preBuild
47- pnpm build
60+ # First build route metadata using directoryImport (avoids executing
61+ # module-level code that would trigger network requests)
62+ BUILD_ROUTES_MODE=1 pnpm run build:routes
63+ # Then build the application
64+ pnpm run build
4865 runHook postBuild
4966 '' ;
5067
@@ -61,8 +78,7 @@ stdenv.mkDerivation (finalAttrs: {
6178 --chdir "$out/lib/rsshub" \
6279 --set "NODE_ENV" "production" \
6380 --set "NO_LOGFILES" "true" \
64- --set "TSX_TSCONFIG_PATH" "$out/lib/rsshub/tsconfig.json" \
65- --append-flags "$out/lib/rsshub/dist/index.mjs"
81+ --add-flags "$out/lib/rsshub/dist/index.mjs"
6682 '' ;
6783
6884 passthru . updateScript = nix-update-script { extraArgs = [ "--version=branch=master" ] ; } ;
@@ -78,7 +94,7 @@ stdenv.mkDerivation (finalAttrs: {
7894 new features and bug fixes.
7995 '' ;
8096 homepage = "https://docs.rsshub.app" ;
81- license = lib . licenses . mit ;
97+ license = lib . licenses . agpl3Only ;
8298 maintainers = with lib . maintainers ; [ xinyangli ] ;
8399 mainProgram = "rsshub" ;
84100 platforms = lib . platforms . all ;
0 commit comments