1 { lib, php, env, writeText, stdenv, fetchedGit, fetchedGithub }:
5 auth_ldap = stdenv.mkDerivation (fetchedGithub ./ttrss-auth-ldap.json // rec {
8 cp plugins/auth_ldap/init.php $out
11 af_feedmod = stdenv.mkDerivation (fetchedGithub ./ttrss-af_feedmod.json // rec {
12 patches = [ ./ttrss-af-feedmod_type_replace.patch ];
18 feediron = stdenv.mkDerivation (fetchedGithub ./ttrss-feediron.json // rec {
19 patches = [ ./ttrss-feediron_json_reformat.patch ];
25 ff_instagram = stdenv.mkDerivation (fetchedGithub ./ttrss-ff_instagram.json // rec {
31 tumblr_gdpr_ua = stdenv.mkDerivation (fetchedGithub ./ttrss-tumblr_gdpr_ua.json // rec {
39 varDir = "/var/lib/ttrss";
41 deps = [ "wrappers" ];
43 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
44 ${varDir}/lock ${varDir}/cache ${varDir}/feed-icons
45 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/cache/export/ \
46 ${varDir}/cache/feeds/ \
47 ${varDir}/cache/images/ \
49 ${varDir}/cache/simplepie/ \
50 ${varDir}/cache/upload/
51 touch ${varDir}/feed-icons/index.html
52 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
55 config = writeText "config.php" ''
58 define('PHP_EXECUTABLE', '${php}/bin/php');
60 define('LOCK_DIRECTORY', 'lock');
61 define('CACHE_DIR', 'cache');
62 define('ICONS_DIR', 'feed-icons');
63 define('ICONS_URL', 'feed-icons');
64 define('SELF_URL_PATH', 'https://tools.immae.eu/ttrss/');
66 define('MYSQL_CHARSET', 'UTF8');
68 define('DB_TYPE', 'pgsql');
69 define('DB_HOST', '${env.postgresql.socket}');
70 define('DB_USER', '${env.postgresql.user}');
71 define('DB_NAME', '${env.postgresql.database}');
72 define('DB_PASS', '${env.postgresql.password}');
73 define('DB_PORT', '${env.postgresql.port}');
75 define('AUTH_AUTO_CREATE', true);
76 define('AUTH_AUTO_LOGIN', true);
78 define('SINGLE_USER_MODE', false);
80 define('SIMPLE_UPDATE_MODE', false);
81 define('CHECK_FOR_UPDATES', true);
83 define('FORCE_ARTICLE_PURGE', 0);
84 define('SESSION_COOKIE_LIFETIME', 60*60*24*120);
85 define('ENABLE_GZIP_OUTPUT', false);
87 define('PLUGINS', 'auth_ldap, note, instances');
89 define('LOG_DESTINATION', ''');
90 define('CONFIG_VERSION', 26);
93 define('SPHINX_SERVER', 'localhost:9312');
94 define('SPHINX_INDEX', 'ttrss, delta');
96 define('ENABLE_REGISTRATION', false);
97 define('REG_NOTIFY_ADDRESS', 'ttrss@tools.immae.eu');
98 define('REG_MAX_USERS', 10);
100 define('SMTP_FROM_NAME', 'Tiny Tiny RSS');
101 define('SMTP_FROM_ADDRESS', 'ttrss@tools.immae.eu');
102 define('DIGEST_SUBJECT', '[tt-rss] New headlines for last 24 hours');
104 define('LDAP_AUTH_SERVER_URI', 'ldap://ldap.immae.eu:389/');
105 define('LDAP_AUTH_USETLS', TRUE);
106 define('LDAP_AUTH_ALLOW_UNTRUSTED_CERT', TRUE);
107 define('LDAP_AUTH_BASEDN', 'dc=immae,dc=eu');
108 define('LDAP_AUTH_ANONYMOUSBEFOREBIND', FALSE);
109 define('LDAP_AUTH_SEARCHFILTER', '(&(memberOf=cn=users,cn=ttrss,ou=services,dc=immae,dc=eu)(|(cn=???)(uid=???)(&(uid:dn:=???)(ou=ttrss))))');
111 define('LDAP_AUTH_BINDDN', 'cn=ttrss,ou=services,dc=immae,dc=eu');
112 define('LDAP_AUTH_BINDPW', '${env.ldap.password}');
113 define('LDAP_AUTH_LOGIN_ATTRIB', 'immaeTtrssLogin');
115 define('LDAP_AUTH_LOG_ATTEMPTS', FALSE);
116 define('LDAP_AUTH_DEBUG', FALSE);
118 webRoot = stdenv.mkDerivation (fetchedGit ./tt-rss.json // rec {
120 rm -rf lock feed-icons cache
121 ln -sf ${varDir}/{lock,feed-icons,cache} .
125 ln -s ${config} $out/config.php
126 ${builtins.concatStringsSep "\n" (
127 lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/plugins/${name}") plugins
134 modules = [ "proxy_fcgi" ];
135 webappName = "tools_ttrss";
136 root = "/run/current-system/webapps/${webappName}";
138 Alias /ttrss "${root}"
139 <Directory "${root}">
140 DirectoryIndex index.php
141 <FilesMatch "\.php$">
142 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
146 Options FollowSymlinks
152 basedir = builtins.concatStringsSep ":" (
153 [ webRoot config varDir ]
154 ++ lib.attrsets.mapAttrsToList (name: value: value) plugins);
155 socket = "/var/run/phpfpm/ttrss.sock";
158 user = ${apache.user}
159 group = ${apache.group}
160 listen.owner = ${apache.user}
161 listen.group = ${apache.group}
164 pm.process_idle_timeout = 60
166 ; Needed to avoid clashes in browser cookies (same domain)
167 php_value[session.name] = TtrssPHPSESSID
168 php_admin_value[open_basedir] = "${basedir}:/tmp"
169 php_admin_value[session.save_path] = "${varDir}/phpSessions"