]>
Commit | Line | Data |
---|---|---|
ab8f306d | 1 | { lib, pkgs, config, ... }: |
a7f7fdae | 2 | let |
ab8f306d | 3 | env = config.myEnv.tools.diaspora; |
a95ab089 | 4 | root = "/run/current-system/webapps/tools_diaspora"; |
4288c2f2 | 5 | cfg = config.myServices.websites.tools.diaspora; |
7009832a | 6 | dcfg = config.services.diaspora; |
a7f7fdae | 7 | in { |
4288c2f2 | 8 | options.myServices.websites.tools.diaspora = { |
a7f7fdae IB |
9 | enable = lib.mkEnableOption "enable diaspora's website"; |
10 | }; | |
11 | ||
12 | config = lib.mkIf cfg.enable { | |
d2e703c5 | 13 | services.duplyBackup.profiles.diaspora = { |
6a8252b1 IB |
14 | rootDir = dcfg.dataDir; |
15 | }; | |
7009832a | 16 | users.users.diaspora.extraGroups = [ "keys" ]; |
a7f7fdae | 17 | |
1a718805 | 18 | secrets.keys = [ |
3bb8a82a IB |
19 | { |
20 | dest = "webapps/diaspora/diaspora.yml"; | |
21 | user = "diaspora"; | |
22 | group = "diaspora"; | |
23 | permissions = "0400"; | |
24 | text = '' | |
25 | configuration: | |
26 | environment: | |
27 | url: "https://diaspora.immae.eu/" | |
28 | certificate_authorities: '${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt' | |
ab8f306d | 29 | redis: 'redis://${env.redis.host}:${env.redis.port}/${env.redis.db}' |
3bb8a82a IB |
30 | sidekiq: |
31 | s3: | |
32 | assets: | |
33 | logging: | |
34 | logrotate: | |
35 | debug: | |
36 | server: | |
7009832a | 37 | listen: '${dcfg.sockets.rails}' |
3bb8a82a IB |
38 | rails_environment: 'production' |
39 | chat: | |
40 | server: | |
41 | bosh: | |
42 | log: | |
43 | map: | |
44 | mapbox: | |
45 | privacy: | |
46 | piwik: | |
47 | statistics: | |
48 | camo: | |
49 | settings: | |
50 | enable_registrations: false | |
51 | welcome_message: | |
52 | invitations: | |
53 | open: false | |
54 | paypal_donations: | |
55 | community_spotlight: | |
56 | captcha: | |
57 | enable: false | |
58 | terms: | |
59 | maintenance: | |
60 | remove_old_users: | |
61 | default_metas: | |
62 | csp: | |
63 | services: | |
64 | twitter: | |
65 | tumblr: | |
66 | wordpress: | |
67 | mail: | |
68 | enable: true | |
69 | sender_address: 'diaspora@tools.immae.eu' | |
70 | method: 'sendmail' | |
71 | smtp: | |
72 | sendmail: | |
73 | location: '/run/wrappers/bin/sendmail' | |
74 | admins: | |
75 | account: "ismael" | |
76 | podmin_email: 'diaspora@tools.immae.eu' | |
77 | relay: | |
78 | outbound: | |
79 | inbound: | |
80 | ldap: | |
81 | enable: true | |
ab8f306d | 82 | host: ${env.ldap.host} |
3bb8a82a IB |
83 | port: 636 |
84 | only_ldap: true | |
85 | mail_attribute: mail | |
86 | skip_email_confirmation: true | |
87 | use_bind_dn: true | |
ab8f306d | 88 | bind_dn: "${env.ldap.dn}" |
3bb8a82a | 89 | bind_pw: "${env.ldap.password}" |
ab8f306d IB |
90 | search_base: "${env.ldap.base}" |
91 | search_filter: "${env.ldap.filter}" | |
3bb8a82a IB |
92 | production: |
93 | environment: | |
94 | development: | |
95 | environment: | |
96 | ''; | |
97 | } | |
98 | { | |
99 | dest = "webapps/diaspora/database.yml"; | |
100 | user = "diaspora"; | |
101 | group = "diaspora"; | |
102 | permissions = "0400"; | |
103 | text = '' | |
104 | postgresql: &postgresql | |
105 | adapter: postgresql | |
106 | host: "${env.postgresql.socket}" | |
107 | port: "${env.postgresql.port}" | |
108 | username: "${env.postgresql.user}" | |
109 | password: "${env.postgresql.password}" | |
110 | encoding: unicode | |
111 | common: &common | |
112 | <<: *postgresql | |
113 | combined: &combined | |
114 | <<: *common | |
115 | development: | |
116 | <<: *combined | |
117 | database: diaspora_development | |
118 | production: | |
119 | <<: *combined | |
120 | database: ${env.postgresql.database} | |
121 | test: | |
122 | <<: *combined | |
123 | database: "diaspora_test" | |
124 | integration1: | |
125 | <<: *combined | |
126 | database: diaspora_integration1 | |
127 | integration2: | |
128 | <<: *combined | |
129 | database: diaspora_integration2 | |
130 | ''; | |
131 | } | |
132 | { | |
133 | dest = "webapps/diaspora/secret_token.rb"; | |
134 | user = "diaspora"; | |
135 | group = "diaspora"; | |
136 | permissions = "0400"; | |
137 | text = '' | |
138 | Diaspora::Application.config.secret_key_base = '${env.secret_token}' | |
139 | ''; | |
140 | } | |
141 | ]; | |
a7f7fdae | 142 | |
7009832a IB |
143 | services.diaspora = { |
144 | enable = true; | |
145 | package = pkgs.webapps.diaspora.override { ldap = true; }; | |
146 | dataDir = "/var/lib/diaspora_immae"; | |
147 | adminEmail = "diaspora@tools.immae.eu"; | |
148 | configDir = "/var/secrets/webapps/diaspora"; | |
a7f7fdae IB |
149 | }; |
150 | ||
17f6eae9 IB |
151 | services.filesWatcher.diaspora = { |
152 | restart = true; | |
153 | paths = [ dcfg.configDir ]; | |
154 | }; | |
155 | ||
29f8cb85 | 156 | services.websites.env.tools.modules = [ |
a952acc4 | 157 | "headers" "proxy" "proxy_http" |
a7f7fdae | 158 | ]; |
a95ab089 IB |
159 | system.extraSystemBuilderCmds = '' |
160 | mkdir -p $out/webapps | |
7009832a | 161 | ln -s ${dcfg.workdir}/public/ $out/webapps/tools_diaspora |
a95ab089 | 162 | ''; |
29f8cb85 | 163 | services.websites.env.tools.vhostConfs.diaspora = { |
a7f7fdae | 164 | certName = "eldiron"; |
7df420c2 | 165 | addToCerts = true; |
a7f7fdae | 166 | hosts = [ "diaspora.immae.eu" ]; |
a95ab089 | 167 | root = root; |
a7f7fdae IB |
168 | extraConfig = [ '' |
169 | RewriteEngine On | |
170 | RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | |
7009832a | 171 | RewriteRule ^/(.*)$ unix://${dcfg.sockets.rails}|http://diaspora.immae.eu/%{REQUEST_URI} [P,NE,QSA,L] |
a7f7fdae IB |
172 | |
173 | ProxyRequests Off | |
174 | ProxyVia On | |
175 | ProxyPreserveHost On | |
176 | RequestHeader set X_FORWARDED_PROTO https | |
177 | ||
178 | <Proxy *> | |
179 | Require all granted | |
180 | </Proxy> | |
181 | ||
a95ab089 | 182 | <Directory ${root}> |
a7f7fdae IB |
183 | Require all granted |
184 | Options -MultiViews | |
185 | </Directory> | |
186 | '' ]; | |
187 | }; | |
188 | }; | |
189 | } |