1 { lib, pkgs, config, myconfig, ... }:
3 www_root = "/run/current-system/webapps/_www";
4 theme_root = "/run/current-system/webapps/_theme";
7 modules = [ "deflate" "filter" ];
9 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
13 modules = [ "macro" ];
17 <Macro Stats %{domain}>
18 Alias /webstats ${config.services.webstats.dataDir}/%{domain}
19 <Directory ${config.services.webstats.dataDir}/%{domain}>
20 DirectoryIndex index.html
26 Require ldap-group cn=%{domain},ou=stats,cn=httpd,ou=services,dc=immae,dc=eu
32 modules = [ "ldap" "authnz_ldap" ];
34 <IfModule ldap_module>
35 LDAPSharedCacheSize 500000
38 LDAPOpCacheEntries 1024
42 Include /var/secrets/apache-ldap
46 extraConfig = (pkgs.webapps.apache-default.override { inherit www_root;}).apacheConfig;
49 extraConfig = (pkgs.webapps.apache-theme.override { inherit theme_root; }).apacheConfig;
52 modules = [ "http2" ];
59 LogFormat "%{Host}i:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedVhost
63 makeModules = lib.lists.flatten (lib.attrsets.mapAttrsToList (n: v: v.modules or []) apacheConfig);
64 makeExtraConfig = (builtins.filter (x: x != null) (lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) apacheConfig));
67 options.myServices.websites.webappDirs = lib.mkOption {
68 type = lib.types.attrsOf lib.types.path;
70 Webapp paths to create in /run/current-system/webapps
76 services.backup.profiles.php = {
77 rootDir = "/var/lib/php";
79 users.users.wwwrun.extraGroups = [ "keys" ];
80 networking.firewall.allowedTCPPorts = [ 80 443 ];
82 nixpkgs.overlays = [ (self: super: rec {
83 #openssl = self.openssl_1_1;
85 php72 = (super.php72.override {
86 mysql.connector-c = self.mariadb;
87 config.php.mysqlnd = false;
88 config.php.mysqli = false;
89 }).overrideAttrs(old: rec {
90 # Didn't manage to build with mysqli + mysql_config connector
91 configureFlags = old.configureFlags ++ [
92 "--with-mysqli=shared,mysqlnd"
94 # preConfigure = (old.preConfigure or "") + ''
95 # export CPPFLAGS="$CPPFLAGS -I${pkgs.mariadb}/include/mysql/server";
96 # sed -i -e 's/#include "mysqli_priv.h"/#include "mysqli_priv.h"\n#include <mysql_version.h>/' \
97 # ext/mysqli/mysqli.c ext/mysqli/mysqli_prop.c
100 phpPackages = super.php72Packages.override { inherit php; };
104 dest = "apache-ldap";
107 permissions = "0400";
110 <IfModule authnz_ldap_module>
111 AuthLDAPURL ldap://ldap.immae.eu:389/dc=immae,dc=eu STARTTLS
112 AuthLDAPBindDN cn=httpd,ou=services,dc=immae,dc=eu
113 AuthLDAPBindPassword "${myconfig.env.httpd.ldap.password}"
115 AuthName "Authentification requise (Acces LDAP)"
116 AuthBasicProvider ldap
122 system.activationScripts = {
124 install -d -m 0755 ${config.security.acme.directory}/acme-challenge
125 install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions
130 phpPackage = pkgs.php;
132 session.save_path = "/var/lib/php/sessions"
135 session.gc_maxlifetime = 1296000
137 session.cache_expire = 43200
144 services.filesWatcher.httpdProd.paths = [ "/var/secrets/apache-ldap" ];
145 services.filesWatcher.httpdInte.paths = [ "/var/secrets/apache-ldap" ];
146 services.filesWatcher.httpdTools.paths = [ "/var/secrets/apache-ldap" ];
148 services.websites.env.production = {
150 adminAddr = "httpd@immae.eu";
153 let ips = myconfig.env.servers.eldiron.ips.production;
154 in [ips.ip4] ++ (ips.ip6 or []);
155 modules = makeModules;
156 extraConfig = makeExtraConfig;
158 certName = "eldiron";
159 hosts = ["eldiron.immae.eu" ];
161 extraConfig = [ "DirectoryIndex index.htm" ];
165 services.websites.env.integration = {
167 adminAddr = "httpd@immae.eu";
170 let ips = myconfig.env.servers.eldiron.ips.integration;
171 in [ips.ip4] ++ (ips.ip6 or []);
172 modules = makeModules;
173 extraConfig = makeExtraConfig;
175 certName = "eldiron";
176 hosts = ["eldiron.immae.eu" ];
178 extraConfig = [ "DirectoryIndex index.htm" ];
182 services.websites.env.tools = {
184 adminAddr = "httpd@immae.eu";
187 let ips = myconfig.env.servers.eldiron.ips.main;
188 in [ips.ip4] ++ (ips.ip6 or []);
189 modules = makeModules;
190 extraConfig = makeExtraConfig ++
192 RedirectMatch ^/licen[cs]es?_et_tip(ping)?$ https://www.immae.eu/licences_et_tip.html
193 RedirectMatch ^/licen[cs]es?_and_tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html
194 RedirectMatch ^/licen[cs]es?$ https://www.immae.eu/licenses_and_tipping.html
195 RedirectMatch ^/tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html
196 RedirectMatch ^/(mentions|mentions_legales|legal)$ https://www.immae.eu/mentions.html
197 RedirectMatch ^/CGU$ https://www.immae.eu/CGU
202 host = "nossl.immae.eu";
205 certName = "eldiron";
206 hosts = ["eldiron.immae.eu" ];
208 extraConfig = [ "DirectoryIndex index.htm" ];
212 system.extraSystemBuilderCmds = lib.mkIf (builtins.length (builtins.attrValues config.myServices.websites.webappDirs) > 0) ''
213 mkdir -p $out/webapps
214 ${builtins.concatStringsSep "\n" (lib.attrsets.mapAttrsToList (name: path: "ln -s ${path} $out/webapps/${name}") config.myServices.websites.webappDirs)}
217 myServices.websites = {
219 _www = pkgs.webapps.apache-default.www;
220 _theme = pkgs.webapps.apache-theme.theme;
223 aten.integration.enable = true;
224 aten.production.enable = true;
226 capitaines.production.enable = true;
228 chloe.integration.enable = true;
229 chloe.production.enable = true;
231 connexionswing.integration.enable = true;
232 connexionswing.production.enable = true;
234 denisejerome.production.enable = true;
236 emilia.production.enable = true;
238 florian.app.enable = true;
239 florian.integration.enable = true;
240 florian.production.enable = true;
242 immae.production.enable = true;
243 immae.release.enable = true;
244 immae.temp.enable = true;
246 leila.production.enable = true;
248 ludivinecassal.integration.enable = true;
249 ludivinecassal.production.enable = true;
251 nassime.production.enable = true;
253 naturaloutil.production.enable = true;
254 telioTortay.production.enable = true;
256 papa.surveillance.enable = true;
258 piedsjaloux.integration.enable = true;
259 piedsjaloux.production.enable = true;
261 tools.cloud.enable = true;
262 tools.dav.enable = true;
263 tools.db.enable = true;
264 tools.diaspora.enable = true;
265 tools.etherpad-lite.enable = true;
266 tools.git.enable = true;
267 tools.mastodon.enable = true;
268 tools.mediagoblin.enable = true;
269 tools.peertube.enable = true;
270 tools.tools.enable = true;
271 tools.email.enable = true;