aboutsummaryrefslogtreecommitdiff
path: root/nixops
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-12 17:57:20 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-12 17:58:22 +0200
commit8f904d0d982684e8e66dfc5d9123712eb96bf16e (patch)
tree4574838fb67902680f41754d73af8f5d33ce35f6 /nixops
parent9129f327844ca58af61a20582b04e35762c63e35 (diff)
downloadNix-8f904d0d982684e8e66dfc5d9123712eb96bf16e.tar.gz
Nix-8f904d0d982684e8e66dfc5d9123712eb96bf16e.tar.zst
Nix-8f904d0d982684e8e66dfc5d9123712eb96bf16e.zip
Refactor a bit httpd/webapps configuration:
- alias private to pkgs - move default apache vhost to pkgs
Diffstat (limited to 'nixops')
-rw-r--r--nixops/modules/websites/apache/per-server-options.nix188
-rw-r--r--nixops/modules/websites/aten/default.nix4
-rw-r--r--nixops/modules/websites/chloe/default.nix4
-rw-r--r--nixops/modules/websites/connexionswing/default.nix4
-rw-r--r--nixops/modules/websites/default.nix18
-rw-r--r--nixops/modules/websites/ludivine/default.nix4
-rw-r--r--nixops/modules/websites/piedsjaloux/default.nix4
-rw-r--r--nixops/modules/websites/tellesflorian/default.nix2
-rw-r--r--nixops/www/googleb6d69446ff4ca3e5.html1
-rw-r--r--nixops/www/index.htm9
-rw-r--r--nixops/www/maintenance_immae.html58
-rw-r--r--nixops/www/nossl.html11
12 files changed, 13 insertions, 294 deletions
diff --git a/nixops/modules/websites/apache/per-server-options.nix b/nixops/modules/websites/apache/per-server-options.nix
deleted file mode 100644
index 4bbd041..0000000
--- a/nixops/modules/websites/apache/per-server-options.nix
+++ /dev/null
@@ -1,188 +0,0 @@
1# This file defines the options that can be used both for the Apache
2# main server configuration, and for the virtual hosts. (The latter
3# has additional options that affect the web server as a whole, like
4# the user/group to run under.)
5
6{ forMainServer, lib }:
7
8with lib;
9
10{
11
12 hostName = mkOption {
13 type = types.str;
14 default = "localhost";
15 description = "Canonical hostname for the server.";
16 };
17
18 serverAliases = mkOption {
19 type = types.listOf types.str;
20 default = [];
21 example = ["www.example.org" "www.example.org:8080" "example.org"];
22 description = ''
23 Additional names of virtual hosts served by this virtual host configuration.
24 '';
25 };
26
27 port = mkOption {
28 type = types.int;
29 default = 0;
30 description = ''
31 Port for the server. Option will be removed, use <option>listen</option> instead.
32 '';
33 };
34
35 listen = mkOption {
36 type = types.listOf (types.submodule (
37 {
38 options = {
39 port = mkOption {
40 type = types.int;
41 description = "port to listen on";
42 };
43 ip = mkOption {
44 type = types.string;
45 default = "*";
46 description = "Ip to listen on. 0.0.0.0 for ipv4 only, * for all.";
47 };
48 };
49 } ));
50 description = ''
51 List of { /* ip: "*"; */ port = 80;} to listen on
52 '';
53
54 default = [];
55 };
56
57 enableSSL = mkOption {
58 type = types.bool;
59 default = false;
60 description = "Whether to enable SSL (https) support.";
61 };
62
63 # Note: sslServerCert and sslServerKey can be left empty, but this
64 # only makes sense for virtual hosts (they will inherit from the
65 # main server).
66
67 sslServerCert = mkOption {
68 type = types.nullOr types.path;
69 default = null;
70 example = "/var/host.cert";
71 description = "Path to server SSL certificate.";
72 };
73
74 sslServerKey = mkOption {
75 type = types.path;
76 example = "/var/host.key";
77 description = "Path to server SSL certificate key.";
78 };
79
80 sslServerChain = mkOption {
81 type = types.nullOr types.path;
82 default = null;
83 example = "/var/ca.pem";
84 description = "Path to server SSL chain file.";
85 };
86
87 adminAddr = mkOption ({
88 type = types.nullOr types.str;
89 example = "admin@example.org";
90 description = "E-mail address of the server administrator.";
91 } // (if forMainServer then {} else {default = null;}));
92
93 documentRoot = mkOption {
94 type = types.nullOr types.path;
95 default = null;
96 example = "/data/webserver/docs";
97 description = ''
98 The path of Apache's document root directory. If left undefined,
99 an empty directory in the Nix store will be used as root.
100 '';
101 };
102
103 servedDirs = mkOption {
104 type = types.listOf types.attrs;
105 default = [];
106 example = [
107 { urlPath = "/nix";
108 dir = "/home/eelco/Dev/nix-homepage";
109 }
110 ];
111 description = ''
112 This option provides a simple way to serve static directories.
113 '';
114 };
115
116 servedFiles = mkOption {
117 type = types.listOf types.attrs;
118 default = [];
119 example = [
120 { urlPath = "/foo/bar.png";
121 file = "/home/eelco/some-file.png";
122 }
123 ];
124 description = ''
125 This option provides a simple way to serve individual, static files.
126 '';
127 };
128
129 extraConfig = mkOption {
130 type = types.lines;
131 default = "";
132 example = ''
133 <Directory /home>
134 Options FollowSymlinks
135 AllowOverride All
136 </Directory>
137 '';
138 description = ''
139 These lines go to httpd.conf verbatim. They will go after
140 directories and directory aliases defined by default.
141 '';
142 };
143
144 extraSubservices = mkOption {
145 type = types.listOf types.unspecified;
146 default = [];
147 description = "Extra subservices to enable in the webserver.";
148 };
149
150 enableUserDir = mkOption {
151 type = types.bool;
152 default = false;
153 description = ''
154 Whether to enable serving <filename>~/public_html</filename> as
155 <literal>/~<replaceable>username</replaceable></literal>.
156 '';
157 };
158
159 globalRedirect = mkOption {
160 type = types.nullOr types.str;
161 default = null;
162 example = http://newserver.example.org/;
163 description = ''
164 If set, all requests for this host are redirected permanently to
165 the given URL.
166 '';
167 };
168
169 logFormat = mkOption {
170 type = types.str;
171 default = "common";
172 example = "combined";
173 description = ''
174 Log format for Apache's log files. Possible values are: combined, common, referer, agent.
175 '';
176 };
177
178 robotsEntries = mkOption {
179 type = types.lines;
180 default = "";
181 example = "Disallow: /foo/";
182 description = ''
183 Specification of pages to be ignored by web crawlers. See <link
184 xlink:href='http://www.robotstxt.org/'/> for details.
185 '';
186 };
187
188}
diff --git a/nixops/modules/websites/aten/default.nix b/nixops/modules/websites/aten/default.nix
index 0b2ce69..70bb34b 100644
--- a/nixops/modules/websites/aten/default.nix
+++ b/nixops/modules/websites/aten/default.nix
@@ -1,11 +1,11 @@
1{ lib, pkgs, config, myconfig, ... }: 1{ lib, pkgs, config, myconfig, ... }:
2let 2let
3 aten_dev = pkgs.callPackage ./aten.nix { 3 aten_dev = pkgs.callPackage ./aten.nix {
4 inherit (pkgs.private.webapps) aten; 4 inherit (pkgs.webapps) aten;
5 config = myconfig.env.websites.aten.integration; 5 config = myconfig.env.websites.aten.integration;
6 }; 6 };
7 aten_prod = pkgs.callPackage ./aten.nix { 7 aten_prod = pkgs.callPackage ./aten.nix {
8 inherit (pkgs.private.webapps) aten; 8 inherit (pkgs.webapps) aten;
9 config = myconfig.env.websites.aten.production; 9 config = myconfig.env.websites.aten.production;
10 }; 10 };
11 11
diff --git a/nixops/modules/websites/chloe/default.nix b/nixops/modules/websites/chloe/default.nix
index ea984ae..ce67bed 100644
--- a/nixops/modules/websites/chloe/default.nix
+++ b/nixops/modules/websites/chloe/default.nix
@@ -1,11 +1,11 @@
1{ lib, pkgs, config, myconfig, ... }: 1{ lib, pkgs, config, myconfig, ... }:
2let 2let
3 chloe_dev = pkgs.callPackage ./chloe.nix { 3 chloe_dev = pkgs.callPackage ./chloe.nix {
4 inherit (pkgs.private.webapps) chloe; 4 inherit (pkgs.webapps) chloe;
5 config = myconfig.env.websites.chloe.integration; 5 config = myconfig.env.websites.chloe.integration;
6 }; 6 };
7 chloe_prod = pkgs.callPackage ./chloe.nix { 7 chloe_prod = pkgs.callPackage ./chloe.nix {
8 inherit (pkgs.private.webapps) chloe; 8 inherit (pkgs.webapps) chloe;
9 config = myconfig.env.websites.chloe.production; 9 config = myconfig.env.websites.chloe.production;
10 }; 10 };
11 11
diff --git a/nixops/modules/websites/connexionswing/default.nix b/nixops/modules/websites/connexionswing/default.nix
index e31a574..b19af7e 100644
--- a/nixops/modules/websites/connexionswing/default.nix
+++ b/nixops/modules/websites/connexionswing/default.nix
@@ -1,11 +1,11 @@
1{ lib, pkgs, config, myconfig, ... }: 1{ lib, pkgs, config, myconfig, ... }:
2let 2let
3 connexionswing_dev = pkgs.callPackage ./connexionswing.nix { 3 connexionswing_dev = pkgs.callPackage ./connexionswing.nix {
4 inherit (pkgs.private.webapps) connexionswing; 4 inherit (pkgs.webapps) connexionswing;
5 config = myconfig.env.websites.connexionswing.integration; 5 config = myconfig.env.websites.connexionswing.integration;
6 }; 6 };
7 connexionswing_prod = pkgs.callPackage ./connexionswing.nix { 7 connexionswing_prod = pkgs.callPackage ./connexionswing.nix {
8 inherit (pkgs.private.webapps) connexionswing; 8 inherit (pkgs.webapps) connexionswing;
9 config = myconfig.env.websites.connexionswing.production; 9 config = myconfig.env.websites.connexionswing.production;
10 }; 10 };
11 11
diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix
index 891d917..8bbb344 100644
--- a/nixops/modules/websites/default.nix
+++ b/nixops/modules/websites/default.nix
@@ -288,21 +288,7 @@ in
288 ''; 288 '';
289 }; 289 };
290 global = { 290 global = {
291 extraConfig = '' 291 extraConfig = (pkgs.webapps.apache-default.override { inherit www_root;}).apacheConfig;
292 ErrorDocument 500 /maintenance_immae.html
293 ErrorDocument 501 /maintenance_immae.html
294 ErrorDocument 502 /maintenance_immae.html
295 ErrorDocument 503 /maintenance_immae.html
296 ErrorDocument 504 /maintenance_immae.html
297 Alias /maintenance_immae.html ${www_root}/maintenance_immae.html
298 ProxyPass /maintenance_immae.html !
299
300 AliasMatch "(.*)/googleb6d69446ff4ca3e5.html" ${www_root}/googleb6d69446ff4ca3e5.html
301 <Directory ${www_root}>
302 AllowOverride None
303 Require all granted
304 </Directory>
305 '';
306 }; 292 };
307 apaxy = { 293 apaxy = {
308 extraConfig = (pkgs.webapps.apache-theme.override { inherit theme_root; }).apacheConfig; 294 extraConfig = (pkgs.webapps.apache-theme.override { inherit theme_root; }).apacheConfig;
@@ -336,7 +322,7 @@ in
336 adminer = pkgs.callPackage ./commons/adminer.nix {}; 322 adminer = pkgs.callPackage ./commons/adminer.nix {};
337 in '' 323 in ''
338 mkdir -p $out/webapps 324 mkdir -p $out/webapps
339 ln -s ${../../www} $out/webapps/_www 325 ln -s ${pkgs.webapps.apache-default.www} $out/webapps/_www
340 ln -s ${pkgs.webapps.apache-theme.theme} $out/webapps/_theme 326 ln -s ${pkgs.webapps.apache-theme.theme} $out/webapps/_theme
341 ln -s ${adminer.webRoot} $out/webapps/${adminer.apache.webappName} 327 ln -s ${adminer.webRoot} $out/webapps/${adminer.apache.webappName}
342 ''; 328 '';
diff --git a/nixops/modules/websites/ludivine/default.nix b/nixops/modules/websites/ludivine/default.nix
index 69c5720..df75eff 100644
--- a/nixops/modules/websites/ludivine/default.nix
+++ b/nixops/modules/websites/ludivine/default.nix
@@ -1,11 +1,11 @@
1{ lib, pkgs, config, myconfig, ... }: 1{ lib, pkgs, config, myconfig, ... }:
2let 2let
3 ludivinecassal_dev = pkgs.callPackage ./ludivinecassal.nix { 3 ludivinecassal_dev = pkgs.callPackage ./ludivinecassal.nix {
4 inherit (pkgs.private.webapps) ludivinecassal; 4 inherit (pkgs.webapps) ludivinecassal;
5 config = myconfig.env.websites.ludivinecassal.integration; 5 config = myconfig.env.websites.ludivinecassal.integration;
6 }; 6 };
7 ludivinecassal_prod = pkgs.callPackage ./ludivinecassal.nix { 7 ludivinecassal_prod = pkgs.callPackage ./ludivinecassal.nix {
8 inherit (pkgs.private.webapps) ludivinecassal; 8 inherit (pkgs.webapps) ludivinecassal;
9 config = myconfig.env.websites.ludivinecassal.production; 9 config = myconfig.env.websites.ludivinecassal.production;
10 }; 10 };
11 11
diff --git a/nixops/modules/websites/piedsjaloux/default.nix b/nixops/modules/websites/piedsjaloux/default.nix
index 97f9557..10c1f6c 100644
--- a/nixops/modules/websites/piedsjaloux/default.nix
+++ b/nixops/modules/websites/piedsjaloux/default.nix
@@ -1,11 +1,11 @@
1{ lib, pkgs, config, myconfig, ... }: 1{ lib, pkgs, config, myconfig, ... }:
2let 2let
3 piedsjaloux_dev = pkgs.callPackage ./piedsjaloux.nix { 3 piedsjaloux_dev = pkgs.callPackage ./piedsjaloux.nix {
4 inherit (pkgs.private.webapps) piedsjaloux; 4 inherit (pkgs.webapps) piedsjaloux;
5 config = myconfig.env.websites.piedsjaloux.integration; 5 config = myconfig.env.websites.piedsjaloux.integration;
6 }; 6 };
7 piedsjaloux_prod = pkgs.callPackage ./piedsjaloux.nix { 7 piedsjaloux_prod = pkgs.callPackage ./piedsjaloux.nix {
8 inherit (pkgs.private.webapps) piedsjaloux; 8 inherit (pkgs.webapps) piedsjaloux;
9 config = myconfig.env.websites.piedsjaloux.production; 9 config = myconfig.env.websites.piedsjaloux.production;
10 }; 10 };
11 11
diff --git a/nixops/modules/websites/tellesflorian/default.nix b/nixops/modules/websites/tellesflorian/default.nix
index da4b5a6..93ee023 100644
--- a/nixops/modules/websites/tellesflorian/default.nix
+++ b/nixops/modules/websites/tellesflorian/default.nix
@@ -3,7 +3,7 @@ let
3 adminer = pkgs.callPackage ../commons/adminer.nix {}; 3 adminer = pkgs.callPackage ../commons/adminer.nix {};
4 4
5 tellesflorian_dev = pkgs.callPackage ./tellesflorian.nix { 5 tellesflorian_dev = pkgs.callPackage ./tellesflorian.nix {
6 inherit (pkgs.private.webapps) tellesflorian; 6 inherit (pkgs.webapps) tellesflorian;
7 config = myconfig.env.websites.tellesflorian.integration; 7 config = myconfig.env.websites.tellesflorian.integration;
8 }; 8 };
9 9
diff --git a/nixops/www/googleb6d69446ff4ca3e5.html b/nixops/www/googleb6d69446ff4ca3e5.html
deleted file mode 100644
index ff6dbf3..0000000
--- a/nixops/www/googleb6d69446ff4ca3e5.html
+++ /dev/null
@@ -1 +0,0 @@
1google-site-verification: googleb6d69446ff4ca3e5.html \ No newline at end of file
diff --git a/nixops/www/index.htm b/nixops/www/index.htm
deleted file mode 100644
index 0274251..0000000
--- a/nixops/www/index.htm
+++ /dev/null
@@ -1,9 +0,0 @@
1<!DOCTYPE html>
2<html>
3 <head>
4 <title>Hello World HTML</title>
5 </head>
6 <body>
7 <h1>It works!</h1>
8 </body>
9</html>
diff --git a/nixops/www/maintenance_immae.html b/nixops/www/maintenance_immae.html
deleted file mode 100644
index 90f265f..0000000
--- a/nixops/www/maintenance_immae.html
+++ /dev/null
@@ -1,58 +0,0 @@
1<!doctype html>
2<html>
3 <head>
4 <title>Maintenance</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <style>
7 body {
8 padding-left: 5px;
9 padding-right: 5px;
10 text-align: center;
11 margin: auto;
12 font: 20px Helvetica, sans-serif;
13 color: #333;
14 }
15 h1 {
16 margin: 0px;
17 font-size: 40px;
18 }
19 article {
20 display: block;
21 max-width: 650px;
22 margin: 0 auto;
23 padding-top: 30px;
24 }
25 article + article {
26 border-top: 1px solid lightgrey;
27 }
28 article div {
29 text-align: justify;
30 }
31 a {
32 color: #dc8100;
33 text-decoration: none;
34 }
35 a:hover {
36 color: #333;
37 }
38 </style>
39 <script type="text/javascript">
40 setTimeout(function () { location.reload(true); }, 5000);
41 </script>
42 </head>
43 <body>
44 <article>
45 <h1>Erreur serveur ou maintenance en cours&nbsp;!</h1>
46 <div>
47 <p>Une mise à jour ou une opération de maintenance est en cours sur le site. <a href="">Retentez</a> dans quelques instants ou patientez, la page se rechargera automatiquement.</p>
48 </div>
49 </article>
50
51 <article>
52 <h1>Server error or website in maintenance!</h1>
53 <div>
54 <p>An update or a maintenance is on track on the website. Please try <a href="">again</a> in a few seconds or wait, the page will reload automatically.</p>
55 </div>
56 </article>
57 </body>
58</html>
diff --git a/nixops/www/nossl.html b/nixops/www/nossl.html
deleted file mode 100644
index 4401a80..0000000
--- a/nixops/www/nossl.html
+++ /dev/null
@@ -1,11 +0,0 @@
1<!DOCTYPE html>
2<html>
3 <head>
4 <title>No SSL site</title>
5 </head>
6 <body>
7 <h1>No SSL on this site</h1>
8 <p>Use for wifi networks with login page that doesn't work well with
9 https.</p>
10 </body>
11</html>