{ lib, php, env, writeText, stdenv, fetchedGit, fetchedGithub }: let ttrss = let plugins = { auth_ldap = stdenv.mkDerivation (fetchedGithub ./ttrss-auth-ldap.json // rec { installPhase = '' mkdir $out cp plugins/auth_ldap/init.php $out ''; }); af_feedmod = stdenv.mkDerivation (fetchedGithub ./ttrss-af_feedmod.json // rec { patches = [ ./ttrss-af-feedmod_type_replace.patch ]; installPhase = '' mkdir $out cp init.php $out ''; }); feediron = stdenv.mkDerivation (fetchedGithub ./ttrss-feediron.json // rec { patches = [ ./ttrss-feediron_json_reformat.patch ]; installPhase = '' mkdir $out cp -a . $out ''; }); ff_instagram = stdenv.mkDerivation (fetchedGithub ./ttrss-ff_instagram.json // rec { installPhase = '' mkdir $out cp -a . $out ''; }); tumblr_gdpr_ua = stdenv.mkDerivation (fetchedGithub ./ttrss-tumblr_gdpr_ua.json // rec { installPhase = '' mkdir $out cp -a . $out ''; }); }; in rec { varDir = "/var/lib/ttrss"; activationScript = { deps = [ "wrappers" ]; text = '' install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ ${varDir}/lock ${varDir}/cache ${varDir}/feed-icons install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/cache/export/ \ ${varDir}/cache/feeds/ \ ${varDir}/cache/images/ \ ${varDir}/cache/js/ \ ${varDir}/cache/simplepie/ \ ${varDir}/cache/upload/ touch ${varDir}/feed-icons/index.html install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions ''; }; config = writeText "config.php" '' DirectoryIndex index.php SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" AllowOverride All Options FollowSymlinks Require all granted ''; }; phpFpm = rec { basedir = builtins.concatStringsSep ":" ( [ webRoot config varDir ] ++ lib.attrsets.mapAttrsToList (name: value: value) plugins); socket = "/var/run/phpfpm/ttrss.sock"; pool = '' listen = ${socket} user = ${apache.user} group = ${apache.group} listen.owner = ${apache.user} listen.group = ${apache.group} pm = ondemand pm.max_children = 60 pm.process_idle_timeout = 60 ; Needed to avoid clashes in browser cookies (same domain) php_value[session.name] = TtrssPHPSESSID php_admin_value[open_basedir] = "${basedir}:/tmp" php_admin_value[session.save_path] = "${varDir}/phpSessions" ''; }; }; in ttrss