aboutsummaryrefslogtreecommitdiff
path: root/virtual/modules/websites/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'virtual/modules/websites/default.nix')
-rw-r--r--virtual/modules/websites/default.nix93
1 files changed, 36 insertions, 57 deletions
diff --git a/virtual/modules/websites/default.nix b/virtual/modules/websites/default.nix
index b027b81..6b31381 100644
--- a/virtual/modules/websites/default.nix
+++ b/virtual/modules/websites/default.nix
@@ -91,11 +91,18 @@ in
91 ./aten 91 ./aten
92 ./piedsjaloux 92 ./piedsjaloux
93 ./connexionswing 93 ./connexionswing
94 ./tools/db
95 ./tools/tools
96 ./tools/dav
97 ./tools/cloud
98 ./tools/git
94 # built using: 99 # built using:
95 # sed -e "s/services\.httpd/services\.httpdProd/g" .nix-defexpr/channels/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix 100 # sed -e "s/services\.httpd/services\.httpdProd/g" .nix-defexpr/channels/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix
96 # And removed users / groups 101 # And removed users / groups
97 ./apache/httpd_prod.nix 102 ./apache/httpd_prod.nix
98 ./apache/httpd_inte.nix 103 ./apache/httpd_inte.nix
104 # Adapted from base phpfpm
105 ./phpfpm
99 ]; 106 ];
100 107
101 options.services.myWebsites = { 108 options.services.myWebsites = {
@@ -155,6 +162,12 @@ in
155 phpPackages = oldpkgs.php72Packages.override { inherit php; }; 162 phpPackages = oldpkgs.php72Packages.override { inherit php; };
156 }; 163 };
157 164
165 services.myWebsites.tools.databases.enable = true;
166 services.myWebsites.tools.tools.enable = true;
167 services.myWebsites.tools.dav.enable = true;
168 services.myWebsites.tools.cloud.enable = true;
169 services.myWebsites.tools.git.enable = true;
170
158 services.myWebsites.Chloe.production.enable = cfg.production.enable; 171 services.myWebsites.Chloe.production.enable = cfg.production.enable;
159 services.myWebsites.Ludivine.production.enable = cfg.production.enable; 172 services.myWebsites.Ludivine.production.enable = cfg.production.enable;
160 services.myWebsites.Aten.production.enable = cfg.production.enable; 173 services.myWebsites.Aten.production.enable = cfg.production.enable;
@@ -227,6 +240,28 @@ in
227 }; 240 };
228 }; 241 };
229 242
243 system.activationScripts = {
244 httpd = ''
245 install -d -m 0755 /var/lib/acme/acme-challenge
246 install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions
247 install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions/adminer
248 install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions/mantisbt
249 install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions/davical
250 '';
251 };
252
253 services.myPhpfpm = {
254 phpPackage = pkgs.php;
255 phpOptions = ''
256 session.save_path = "/var/lib/php/sessions"
257 session.gc_maxlifetime = 60*60*24*15
258 session.cache_expire = 60*24*30
259 '';
260 extraConfig = ''
261 log_level = notice
262 '';
263 };
264
230 # FIXME: logrotate 265 # FIXME: logrotate
231 # FIXME: ipv6 266 # FIXME: ipv6
232 services.httpdProd = makeService "production" config.services.myWebsites.production; 267 services.httpdProd = makeService "production" config.services.myWebsites.production;
@@ -238,63 +273,7 @@ in
238 services.myWebsites.integration.extraConfig = (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig)); 273 services.myWebsites.integration.extraConfig = (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig));
239 274
240 services.httpd = makeService "tools" config.services.myWebsites.tools; 275 services.httpd = makeService "tools" config.services.myWebsites.tools;
241 services.myWebsites.tools.modules = 276 services.myWebsites.tools.modules = pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules or []) cfg.apacheConfig);
242 mypkgs.adminer.apache.modules ++
243 mypkgs.nextcloud.apache.modules ++
244 mypkgs.ympd.apache.modules ++
245 mypkgs.mantisbt.apache.modules ++
246 mypkgs.ttrss.apache.modules ++
247 mypkgs.roundcubemail.apache.modules ++
248 pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules or []) cfg.apacheConfig);
249 services.myWebsites.tools.extraConfig = (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig)); 277 services.myWebsites.tools.extraConfig = (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig));
250 # FIXME: move them all to separate modules
251 services.myWebsites.tools.vhostConfs.eldiron = {
252 certName = "eldiron";
253 hosts = ["eldiron.immae.eu" ];
254 root = ../../www;
255 extraConfig = [ "DirectoryIndex index.htm" ];
256 };
257 services.myWebsites.tools.vhostConfs.db-1 = {
258 certName = "eldiron";
259 hosts = ["db-1.immae.eu" ];
260 root = null;
261 extraConfig = [ mypkgs.adminer.apache.vhostConf ];
262 };
263 services.myWebsites.tools.vhostConfs.tools = {
264 certName = "eldiron";
265 hosts = ["tools.immae.eu" ];
266 root = null;
267 extraConfig = [
268 mypkgs.adminer.apache.vhostConf
269 mypkgs.ympd.apache.vhostConf
270 mypkgs.ttrss.apache.vhostConf
271 mypkgs.roundcubemail.apache.vhostConf
272 ];
273 };
274 services.myWebsites.tools.vhostConfs.dav = {
275 certName = "eldiron";
276 hosts = ["dav.immae.eu" ];
277 root = null;
278 extraConfig = [
279 mypkgs.infcloud.apache.vhostConf
280 mypkgs.davical.apache.vhostConf
281 ];
282 };
283 services.myWebsites.tools.vhostConfs.cloud = {
284 certName = "eldiron";
285 hosts = ["cloud.immae.eu" ];
286 root = mypkgs.nextcloud.webRoot;
287 extraConfig = [
288 mypkgs.nextcloud.apache.vhostConf
289 ];
290 };
291 services.myWebsites.tools.vhostConfs.git.extraConfig = [
292 mypkgs.mantisbt.apache.vhostConf
293 ''
294 RewriteEngine on
295 RewriteCond %{REQUEST_URI} ^/releases
296 RewriteRule /releases(.*) https://release.immae.eu$1 [P,L]
297 ''
298 ];
299 }; 278 };
300} 279}