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