aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-29 23:42:06 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-29 23:42:06 +0100
commit9a35b8f94cc55ee429b36be1a5e7eb1f52934a34 (patch)
tree09dd68195979d41e0162ef482d1a4198547c5e4e /nixops/modules
parentdc9fb82633b0354630476c2547dafd8ff1bfb3f1 (diff)
downloadNix-9a35b8f94cc55ee429b36be1a5e7eb1f52934a34.tar.gz
Nix-9a35b8f94cc55ee429b36be1a5e7eb1f52934a34.tar.zst
Nix-9a35b8f94cc55ee429b36be1a5e7eb1f52934a34.zip
Move Émilia's website
Diffstat (limited to 'nixops/modules')
-rw-r--r--nixops/modules/websites/default.nix2
-rw-r--r--nixops/modules/websites/emilia/default.nix73
-rw-r--r--nixops/modules/websites/emilia/moodle/pause.html48
3 files changed, 123 insertions, 0 deletions
diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix
index 4a6a26f..7bd1ac5 100644
--- a/nixops/modules/websites/default.nix
+++ b/nixops/modules/websites/default.nix
@@ -91,6 +91,7 @@ in
91 ./piedsjaloux 91 ./piedsjaloux
92 ./connexionswing 92 ./connexionswing
93 ./tellesflorian 93 ./tellesflorian
94 ./emilia
94 ./ftp/jerome.nix 95 ./ftp/jerome.nix
95 ./ftp/nassime.nix 96 ./ftp/nassime.nix
96 ./ftp/florian.nix 97 ./ftp/florian.nix
@@ -195,6 +196,7 @@ in
195 services.myWebsites.Nassime.production.enable = cfg.production.enable; 196 services.myWebsites.Nassime.production.enable = cfg.production.enable;
196 services.myWebsites.Florian.production.enable = cfg.production.enable; 197 services.myWebsites.Florian.production.enable = cfg.production.enable;
197 services.myWebsites.DeniseJerome.production.enable = cfg.production.enable; 198 services.myWebsites.DeniseJerome.production.enable = cfg.production.enable;
199 services.myWebsites.Emilia.production.enable = cfg.production.enable;
198 200
199 services.myWebsites.Chloe.integration.enable = cfg.integration.enable; 201 services.myWebsites.Chloe.integration.enable = cfg.integration.enable;
200 services.myWebsites.Ludivine.integration.enable = cfg.integration.enable; 202 services.myWebsites.Ludivine.integration.enable = cfg.integration.enable;
diff --git a/nixops/modules/websites/emilia/default.nix b/nixops/modules/websites/emilia/default.nix
new file mode 100644
index 0000000..5783ed0
--- /dev/null
+++ b/nixops/modules/websites/emilia/default.nix
@@ -0,0 +1,73 @@
1{ lib, pkgs, config, myconfig, mylibs, ... }:
2let
3 cfg = config.services.myWebsites.Emilia;
4 env = myconfig.env.websites.emilia;
5 varDir = "/var/lib/moodle";
6 siteDir = ./moodle;
7 # php_admin_value[upload_max_filesize] = 50000000
8 # php_admin_value[post_max_size] = 50000000
9 configFile = ''
10 <?php // Moodle configuration file
11
12 unset($CFG);
13 global $CFG;
14 $CFG = new stdClass();
15
16 $CFG->dbtype = 'pgsql';
17 $CFG->dblibrary = 'native';
18 $CFG->dbhost = '${env.postgresql.host}';
19 $CFG->dbname = '${env.postgresql.database}';
20 $CFG->dbuser = '${env.postgresql.user}';
21 $CFG->dbpass = '${env.postgresql.password}';
22 $CFG->prefix = 'mdl_';
23 $CFG->dboptions = array (
24 'dbpersist' => 0,
25 'dbport' => '${env.postgreesql.port}',
26 'dbsocket' => '${env.postgresql.password}',
27 );
28
29 $CFG->wwwroot = 'https://www.saison-photo.org';
30 $CFG->dataroot = '${varDir}';
31 $CFG->admin = 'admin';
32
33 $CFG->directorypermissions = 02777;
34
35 require_once(__DIR__ . '/lib/setup.php');
36
37 // There is no php closing tag in this file,
38 // it is intentional because it prevents trailing whitespace problems!
39 '';
40in {
41 options.services.myWebsites.Emilia = {
42 production = {
43 enable = lib.mkEnableOption "enable Emilia's website";
44 };
45 };
46
47 config = lib.mkIf cfg.production.enable {
48 security.acme.certs."emilia" = config.services.myCertificates.certConfig // {
49 domain = "saison-photo.org";
50 extraDomains = {
51 "www.saison-photo.org" = null;
52 };
53 };
54
55 system.activationScripts.emilia = ''
56 install -m 0755 -o wwwrun -g wwwrun -d ${varDir}
57 '';
58 services.myWebsites.production.vhostConfs.emilia = {
59 certName = "emilia";
60 hosts = [ "saison-photo.org" "www.saison-photo.org" ];
61 root = siteDir;
62 extraConfig = [
63 ''
64 <Directory ${siteDir}>
65 DirectoryIndex pause.html
66 Options Indexes FollowSymLinks MultiViews Includes
67 Require all granted
68 </Directory>
69 ''
70 ];
71 };
72 };
73}
diff --git a/nixops/modules/websites/emilia/moodle/pause.html b/nixops/modules/websites/emilia/moodle/pause.html
new file mode 100644
index 0000000..8b99c59
--- /dev/null
+++ b/nixops/modules/websites/emilia/moodle/pause.html
@@ -0,0 +1,48 @@
1<!doctype html>
2<html>
3 <head>
4 <title>Pause</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 </head>
40 <body>
41 <article>
42 <h1>Site web en pause&nbsp;!</h1>
43 <div>
44 <p>Le site et les cours de photographie sont actuellement en pause.</p>
45 </div>
46 </article>
47 </body>
48</html>