diff options
Diffstat (limited to 'nixops/modules/websites/default.nix')
-rw-r--r-- | nixops/modules/websites/default.nix | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix index 3db1cfa..c8f7481 100644 --- a/nixops/modules/websites/default.nix +++ b/nixops/modules/websites/default.nix | |||
@@ -1,6 +1,8 @@ | |||
1 | { lib, pkgs, config, mylibs, myconfig, ... }: | 1 | { lib, pkgs, config, mylibs, myconfig, ... }: |
2 | let | 2 | let |
3 | cfg = config.services.myWebsites; | 3 | cfg = config.services.myWebsites; |
4 | www_root = "/run/current-system/webapps/_www"; | ||
5 | theme_root = "/run/current-system/webapps/_theme"; | ||
4 | makeService = name: cfg: let | 6 | makeService = name: cfg: let |
5 | toVhost = vhostConf: { | 7 | toVhost = vhostConf: { |
6 | enableSSL = true; | 8 | enableSSL = true; |
@@ -21,9 +23,9 @@ let | |||
21 | hostName = "nossl.immae.eu"; | 23 | hostName = "nossl.immae.eu"; |
22 | enableSSL = false; | 24 | enableSSL = false; |
23 | logFormat = "combinedVhost"; | 25 | logFormat = "combinedVhost"; |
24 | documentRoot = ../../www; | 26 | documentRoot = www_root; |
25 | extraConfig = '' | 27 | extraConfig = '' |
26 | <Directory ${../../www}> | 28 | <Directory ${www_root}> |
27 | DirectoryIndex nossl.html | 29 | DirectoryIndex nossl.html |
28 | AllowOverride None | 30 | AllowOverride None |
29 | Require all granted | 31 | Require all granted |
@@ -52,7 +54,7 @@ let | |||
52 | fallbackVhost = toVhost { # Should go first, default choice | 54 | fallbackVhost = toVhost { # Should go first, default choice |
53 | certName = "eldiron"; | 55 | certName = "eldiron"; |
54 | hosts = ["eldiron.immae.eu" ]; | 56 | hosts = ["eldiron.immae.eu" ]; |
55 | root = ../../www; | 57 | root = www_root; |
56 | extraConfig = [ "DirectoryIndex index.htm" ]; | 58 | extraConfig = [ "DirectoryIndex index.htm" ]; |
57 | }; | 59 | }; |
58 | in rec { | 60 | in rec { |
@@ -290,11 +292,11 @@ in | |||
290 | ErrorDocument 502 /maintenance_immae.html | 292 | ErrorDocument 502 /maintenance_immae.html |
291 | ErrorDocument 503 /maintenance_immae.html | 293 | ErrorDocument 503 /maintenance_immae.html |
292 | ErrorDocument 504 /maintenance_immae.html | 294 | ErrorDocument 504 /maintenance_immae.html |
293 | Alias /maintenance_immae.html ${../../www}/maintenance_immae.html | 295 | Alias /maintenance_immae.html ${www_root}/maintenance_immae.html |
294 | ProxyPass /maintenance_immae.html ! | 296 | ProxyPass /maintenance_immae.html ! |
295 | 297 | ||
296 | AliasMatch "(.*)/googleb6d69446ff4ca3e5.html" ${../../www}/googleb6d69446ff4ca3e5.html | 298 | AliasMatch "(.*)/googleb6d69446ff4ca3e5.html" ${www_root}/googleb6d69446ff4ca3e5.html |
297 | <Directory ${../../www}> | 299 | <Directory ${www_root}> |
298 | AllowOverride None | 300 | AllowOverride None |
299 | Require all granted | 301 | Require all granted |
300 | </Directory> | 302 | </Directory> |
@@ -303,8 +305,8 @@ in | |||
303 | apaxy = { | 305 | apaxy = { |
304 | extraConfig = '' | 306 | extraConfig = '' |
305 | <Macro Apaxy %{folder} %{ignored}> | 307 | <Macro Apaxy %{folder} %{ignored}> |
306 | Alias /theme ${./apache/theme} | 308 | Alias /theme ${theme_root} |
307 | <Directory ${./apache/theme}> | 309 | <Directory ${theme_root}> |
308 | Options -Indexes | 310 | Options -Indexes |
309 | AllowOverride None | 311 | AllowOverride None |
310 | Require all granted | 312 | Require all granted |
@@ -407,6 +409,15 @@ in | |||
407 | ''; | 409 | ''; |
408 | }; | 410 | }; |
409 | 411 | ||
412 | system.extraSystemBuilderCmds = let | ||
413 | adminer = pkgs.callPackage ./commons/adminer.nix {}; | ||
414 | in '' | ||
415 | mkdir -p $out/webapps | ||
416 | ln -s ${../../www} $out/webapps/_www | ||
417 | ln -s ${./apache/theme} $out/webapps/_theme | ||
418 | ln -s ${adminer.webRoot} $out/webapps/${adminer.apache.webappName} | ||
419 | ''; | ||
420 | |||
410 | services.myPhpfpm = { | 421 | services.myPhpfpm = { |
411 | phpPackage = pkgs.php; | 422 | phpPackage = pkgs.php; |
412 | phpOptions = '' | 423 | phpOptions = '' |