1 { lib, pkgs, config, myconfig, mylibs, ... }:
3 env = myconfig.env.tools.diaspora;
4 root = "/run/current-system/webapps/tools_diaspora";
5 cfg = config.services.myWebsites.tools.diaspora;
6 dcfg = config.services.diaspora;
8 options.services.myWebsites.tools.diaspora = {
9 enable = lib.mkEnableOption "enable diaspora's website";
12 config = lib.mkIf cfg.enable {
13 users.users.diaspora.extraGroups = [ "keys" ];
17 dest = "webapps/diaspora/diaspora.yml";
24 url: "https://diaspora.immae.eu/"
25 certificate_authorities: '${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt'
26 redis: '${env.redis_url}'
34 listen: '${dcfg.sockets.rails}'
35 rails_environment: 'production'
47 enable_registrations: false
66 sender_address: 'diaspora@tools.immae.eu'
70 location: '/run/wrappers/bin/sendmail'
73 podmin_email: 'diaspora@tools.immae.eu'
83 skip_email_confirmation: true
85 bind_dn: "cn=diaspora,ou=services,dc=immae,dc=eu"
86 bind_pw: "${env.ldap.password}"
87 search_base: "dc=immae,dc=eu"
88 search_filter: "(&(memberOf=cn=users,cn=diaspora,ou=services,dc=immae,dc=eu)(uid=%{username}))"
96 dest = "webapps/diaspora/database.yml";
101 postgresql: &postgresql
103 host: "${env.postgresql.socket}"
104 port: "${env.postgresql.port}"
105 username: "${env.postgresql.user}"
106 password: "${env.postgresql.password}"
114 database: diaspora_development
117 database: ${env.postgresql.database}
120 database: "diaspora_test"
123 database: diaspora_integration1
126 database: diaspora_integration2
130 dest = "webapps/diaspora/secret_token.rb";
133 permissions = "0400";
135 Diaspora::Application.config.secret_key_base = '${env.secret_token}'
140 services.diaspora = {
142 package = pkgs.webapps.diaspora.override { ldap = true; };
143 dataDir = "/var/lib/diaspora_immae";
144 adminEmail = "diaspora@tools.immae.eu";
145 configDir = "/var/secrets/webapps/diaspora";
148 services.myWebsites.tools.modules = [
149 "headers" "proxy" "proxy_http"
151 security.acme.certs."eldiron".extraDomains."diaspora.immae.eu" = null;
152 system.extraSystemBuilderCmds = ''
153 mkdir -p $out/webapps
154 ln -s ${dcfg.workdir}/public/ $out/webapps/tools_diaspora
156 services.myWebsites.tools.vhostConfs.diaspora = {
157 certName = "eldiron";
158 hosts = [ "diaspora.immae.eu" ];
162 RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
163 RewriteRule ^/(.*)$ unix://${dcfg.sockets.rails}|http://diaspora.immae.eu/%{REQUEST_URI} [P,NE,QSA,L]
168 RequestHeader set X_FORWARDED_PROTO https