1{
2 stdenvNoCC,
3 lib,
4 fetchFromGitHub,
5 nixosTests,
6 php,
7 writeText,
8}:
9
10stdenvNoCC.mkDerivation rec {
11 pname = "FreshRSS";
12 version = "1.26.3";
13
14 src = fetchFromGitHub {
15 owner = "FreshRSS";
16 repo = "FreshRSS";
17 rev = version;
18 hash = "sha256-/573UMMALfU46uJefxf/DMhEcIMiI+CVR9lg9kXFdF0=";
19 };
20
21 postPatch = ''
22 patchShebangs cli/*.php app/actualize_script.php
23 '';
24
25 # THIRDPARTY_EXTENSIONS_PATH can only be set by config, but should be read from an env-var.
26 overrideConfig = writeText "constants.local.php" ''
27 <?php
28 $thirdpartyExtensionsPath = getenv('THIRDPARTY_EXTENSIONS_PATH');
29 if (is_string($thirdpartyExtensionsPath) && $thirdpartyExtensionsPath !== "") {
30 define('THIRDPARTY_EXTENSIONS_PATH', $thirdpartyExtensionsPath . '/extensions');
31 }
32 '';
33
34 buildInputs = [ php ];
35
36 # There's nothing to build.
37 dontBuild = true;
38
39 installPhase = ''
40 runHook preInstall
41 mkdir -p $out
42 cp -vr * $out/
43 cp $overrideConfig $out/constants.local.php
44 runHook postInstall
45 '';
46
47 passthru.tests = {
48 inherit (nixosTests) freshrss;
49 };
50
51 meta = with lib; {
52 description = "FreshRSS is a free, self-hostable RSS aggregator";
53 homepage = "https://www.freshrss.org/";
54 license = licenses.agpl3Plus;
55 maintainers = with maintainers; [
56 etu
57 stunkymonkey
58 ];
59 };
60}