aboutsummaryrefslogtreecommitdiff
path: root/virtual/packages/ttrss.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-12 12:41:23 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-12 21:59:41 +0100
commit108891744eaa7410e305871212d5b81c1b67a095 (patch)
tree90e3f1a87573532ed1c14e233ad7348904ce47f8 /virtual/packages/ttrss.nix
parent950ca5ee979ae2467f3471216140de2c1d572f4b (diff)
downloadNix-108891744eaa7410e305871212d5b81c1b67a095.tar.gz
Nix-108891744eaa7410e305871212d5b81c1b67a095.tar.zst
Nix-108891744eaa7410e305871212d5b81c1b67a095.zip
Refactor websites.
This commit refactors websites into module per "vhost".
Diffstat (limited to 'virtual/packages/ttrss.nix')
-rw-r--r--virtual/packages/ttrss.nix182
1 files changed, 0 insertions, 182 deletions
diff --git a/virtual/packages/ttrss.nix b/virtual/packages/ttrss.nix
deleted file mode 100644
index f7b0f61..0000000
--- a/virtual/packages/ttrss.nix
+++ /dev/null
@@ -1,182 +0,0 @@
1{ lib, php, checkEnv, writeText, stdenv, fetchedGit, fetchedGithub }:
2let
3 ttrss = let
4 plugins = {
5 auth_ldap = stdenv.mkDerivation (fetchedGithub ./ttrss-auth-ldap.json // rec {
6 installPhase = ''
7 mkdir $out
8 cp plugins/auth_ldap/init.php $out
9 '';
10 });
11 af_feedmod = stdenv.mkDerivation (fetchedGithub ./ttrss-af_feedmod.json // rec {
12 patches = [ ./ttrss-af-feedmod_type_replace.patch ];
13 installPhase = ''
14 mkdir $out
15 cp init.php $out
16 '';
17 });
18 feediron = stdenv.mkDerivation (fetchedGithub ./ttrss-feediron.json // rec {
19 patches = [ ./ttrss-feediron_json_reformat.patch ];
20 installPhase = ''
21 mkdir $out
22 cp -a . $out
23 '';
24 });
25 ff_instagram = stdenv.mkDerivation (fetchedGithub ./ttrss-ff_instagram.json // rec {
26 installPhase = ''
27 mkdir $out
28 cp -a . $out
29 '';
30 });
31 tumblr_gdpr_ua = stdenv.mkDerivation (fetchedGithub ./ttrss-tumblr_gdpr_ua.json // rec {
32 installPhase = ''
33 mkdir $out
34 cp -a . $out
35 '';
36 });
37 };
38 in rec {
39 varDir = "/var/lib/ttrss";
40 # FIXME: initial sync
41 activationScript = {
42 deps = [ "wrappers" ];
43 text = ''
44 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
45 ${varDir}/lock ${varDir}/cache ${varDir}/feed-icons
46 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/cache/export/ \
47 ${varDir}/cache/feeds/ \
48 ${varDir}/cache/images/ \
49 ${varDir}/cache/js/ \
50 ${varDir}/cache/simplepie/ \
51 ${varDir}/cache/upload/
52 touch ${varDir}/feed-icons/index.html
53 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
54 '';
55 };
56 config =
57 # FIXME: LOG_DESTINATION syslog?
58 assert checkEnv "NIXOPS_TTRSS_DB_PASSWORD";
59 assert checkEnv "NIXOPS_TTRSS_LDAP_PASSWORD";
60 writeText "config.php" ''
61 <?php
62
63 define('PHP_EXECUTABLE', '${php}/bin/php');
64
65 define('LOCK_DIRECTORY', 'lock');
66 define('CACHE_DIR', 'cache');
67 define('ICONS_DIR', 'feed-icons');
68 define('ICONS_URL', 'feed-icons');
69 define('SELF_URL_PATH', 'https://tools.immae.eu/ttrss/');
70
71 define('MYSQL_CHARSET', 'UTF8');
72
73 define('DB_TYPE', 'pgsql');
74 define('DB_HOST', 'db-1.immae.eu');
75 define('DB_USER', 'ttrss');
76 define('DB_NAME', 'ttrss');
77 define('DB_PASS', '${builtins.getEnv "NIXOPS_TTRSS_DB_PASSWORD"}');
78 define('DB_PORT', '5432');
79
80 define('AUTH_AUTO_CREATE', true);
81 define('AUTH_AUTO_LOGIN', true);
82
83 define('SINGLE_USER_MODE', false);
84
85 define('SIMPLE_UPDATE_MODE', false);
86 define('CHECK_FOR_UPDATES', true);
87
88 define('FORCE_ARTICLE_PURGE', 0);
89 define('SESSION_COOKIE_LIFETIME', 60*60*24*120);
90 define('ENABLE_GZIP_OUTPUT', false);
91
92 define('PLUGINS', 'auth_ldap, note, instances');
93
94 define('LOG_DESTINATION', ''');
95 define('CONFIG_VERSION', 26);
96
97
98 define('SPHINX_SERVER', 'localhost:9312');
99 define('SPHINX_INDEX', 'ttrss, delta');
100
101 define('ENABLE_REGISTRATION', false);
102 define('REG_NOTIFY_ADDRESS', 'outils@immae.eu');
103 define('REG_MAX_USERS', 10);
104
105 define('SMTP_SERVER', 'mail.immae.eu:25');
106 define('SMTP_LOGIN', ''');
107 define('SMTP_PASSWORD', ''');
108 define('SMTP_SECURE', 'tls');
109
110 define('SMTP_FROM_NAME', 'Tiny Tiny RSS');
111 define('SMTP_FROM_ADDRESS', 'outils@immae.eu');
112 define('DIGEST_SUBJECT', '[tt-rss] New headlines for last 24 hours');
113
114 define('LDAP_AUTH_SERVER_URI', 'ldap://ldap.immae.eu:389/');
115 define('LDAP_AUTH_USETLS', TRUE);
116 define('LDAP_AUTH_ALLOW_UNTRUSTED_CERT', TRUE);
117 define('LDAP_AUTH_BASEDN', 'dc=immae,dc=eu');
118 define('LDAP_AUTH_ANONYMOUSBEFOREBIND', FALSE);
119 define('LDAP_AUTH_SEARCHFILTER', '(&(memberOf=cn=users,cn=ttrss,ou=services,dc=immae,dc=eu)(|(cn=???)(uid=???)(&(uid:dn:=???)(ou=ttrss))))');
120
121 define('LDAP_AUTH_BINDDN', 'cn=ttrss,ou=services,dc=immae,dc=eu');
122 define('LDAP_AUTH_BINDPW', '${builtins.getEnv "NIXOPS_TTRSS_LDAP_PASSWORD"}');
123 define('LDAP_AUTH_LOGIN_ATTRIB', 'immaeTtrssLogin');
124
125 define('LDAP_AUTH_LOG_ATTEMPTS', FALSE);
126 define('LDAP_AUTH_DEBUG', FALSE);
127 '';
128 webRoot = stdenv.mkDerivation (fetchedGit ./tt-rss.json // rec {
129 buildPhase = ''
130 rm -rf lock feed-icons cache
131 ln -sf ../../../../../${varDir}/{lock,feed-icons,cache} .
132 '';
133 installPhase = ''
134 cp -a . $out
135 ln -s ${config} $out/config.php
136 ${builtins.concatStringsSep "\n" (
137 lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/plugins/${name}") plugins
138 )}
139 '';
140 });
141 apache = {
142 user = "wwwrun";
143 group = "wwwrun";
144 modules = [ "proxy_fcgi" ];
145 vhostConf = ''
146 Alias /ttrss "${webRoot}"
147 <Directory "${webRoot}">
148 DirectoryIndex index.php
149 <FilesMatch "\.php$">
150 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
151 </FilesMatch>
152
153 AllowOverride All
154 Options FollowSymlinks
155 Require all granted
156 </Directory>
157 '';
158 };
159 phpFpm = rec {
160 basedir = builtins.concatStringsSep ":" (
161 [ webRoot config varDir ]
162 ++ lib.attrsets.mapAttrsToList (name: value: value) plugins);
163 socket = "/var/run/phpfpm/ttrss.sock";
164 pool = ''
165 listen = ${socket}
166 user = ${apache.user}
167 group = ${apache.group}
168 listen.owner = ${apache.user}
169 listen.group = ${apache.group}
170 pm = ondemand
171 pm.max_children = 60
172 pm.process_idle_timeout = 60
173
174 ; Needed to avoid clashes in browser cookies (same domain)
175 php_value[session.name] = TtrssPHPSESSID
176 php_admin_value[open_basedir] = "${basedir}:/tmp"
177 php_admin_value[session.save_path] = "${varDir}/phpSessions"
178 '';
179 };
180 };
181in
182 ttrss