diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-12-13 21:25:24 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-24 01:40:13 +0200 |
commit | 252dd7d899b7a0deea1537cc5d2d48b825afffb0 (patch) | |
tree | f51c3c9cd7429b0b9553a840f26bee489be045bc /modules/private/websites/emilia/production.nix | |
download | NUR-252dd7d899b7a0deea1537cc5d2d48b825afffb0.tar.gz NUR-252dd7d899b7a0deea1537cc5d2d48b825afffb0.tar.zst NUR-252dd7d899b7a0deea1537cc5d2d48b825afffb0.zip |
Initial commit published for NURnur_root
Diffstat (limited to 'modules/private/websites/emilia/production.nix')
-rw-r--r-- | modules/private/websites/emilia/production.nix | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/modules/private/websites/emilia/production.nix b/modules/private/websites/emilia/production.nix new file mode 100644 index 00000000..13f008f7 --- /dev/null +++ b/modules/private/websites/emilia/production.nix | |||
@@ -0,0 +1,66 @@ | |||
1 | { lib, pkgs, config, myconfig, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.emilia.production; | ||
4 | env = myconfig.env.websites.emilia; | ||
5 | varDir = "/var/lib/moodle"; | ||
6 | siteDir = ./moodle; | ||
7 | webappName = "emilia_moodle"; | ||
8 | root = "/run/current-system/webapps/${webappName}"; | ||
9 | # php_admin_value[upload_max_filesize] = 50000000 | ||
10 | # php_admin_value[post_max_size] = 50000000 | ||
11 | configFile = '' | ||
12 | <?php // Moodle configuration file | ||
13 | |||
14 | unset($CFG); | ||
15 | global $CFG; | ||
16 | $CFG = new stdClass(); | ||
17 | |||
18 | $CFG->dbtype = 'pgsql'; | ||
19 | $CFG->dblibrary = 'native'; | ||
20 | $CFG->dbhost = '${env.postgresql.host}'; | ||
21 | $CFG->dbname = '${env.postgresql.database}'; | ||
22 | $CFG->dbuser = '${env.postgresql.user}'; | ||
23 | $CFG->dbpass = '${env.postgresql.password}'; | ||
24 | $CFG->prefix = 'mdl_'; | ||
25 | $CFG->dboptions = array ( | ||
26 | 'dbpersist' => 0, | ||
27 | 'dbport' => '${env.postgreesql.port}', | ||
28 | 'dbsocket' => '${env.postgresql.password}', | ||
29 | ); | ||
30 | |||
31 | $CFG->wwwroot = 'https://www.saison-photo.org'; | ||
32 | $CFG->dataroot = '${varDir}'; | ||
33 | $CFG->admin = 'admin'; | ||
34 | |||
35 | $CFG->directorypermissions = 02777; | ||
36 | |||
37 | require_once(__DIR__ . '/lib/setup.php'); | ||
38 | |||
39 | // There is no php closing tag in this file, | ||
40 | // it is intentional because it prevents trailing whitespace problems! | ||
41 | ''; | ||
42 | in { | ||
43 | options.myServices.websites.emilia.production.enable = lib.mkEnableOption "enable Emilia's website"; | ||
44 | |||
45 | config = lib.mkIf cfg.enable { | ||
46 | system.activationScripts.emilia = '' | ||
47 | install -m 0755 -o wwwrun -g wwwrun -d ${varDir} | ||
48 | ''; | ||
49 | myServices.websites.webappDirs."${webappName}" = siteDir; | ||
50 | services.websites.production.vhostConfs.emilia = { | ||
51 | certName = "emilia"; | ||
52 | certMainHost = "saison-photo.org"; | ||
53 | hosts = [ "saison-photo.org" "www.saison-photo.org" ]; | ||
54 | root = root; | ||
55 | extraConfig = [ | ||
56 | '' | ||
57 | <Directory ${root}> | ||
58 | DirectoryIndex pause.html | ||
59 | Options Indexes FollowSymLinks MultiViews Includes | ||
60 | Require all granted | ||
61 | </Directory> | ||
62 | '' | ||
63 | ]; | ||
64 | }; | ||
65 | }; | ||
66 | } | ||