]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame_incremental - nixops/modules/websites/emilia/default.nix
Add users for redis and nullmailer
[perso/Immae/Config/Nix.git] / nixops / modules / websites / emilia / default.nix
... / ...
CommitLineData
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}