blob: 5783ed0dafee7f26cecc6b5650bb15831cbd0214 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
{ lib, pkgs, config, myconfig, mylibs, ... }:
let
cfg = config.services.myWebsites.Emilia;
env = myconfig.env.websites.emilia;
varDir = "/var/lib/moodle";
siteDir = ./moodle;
# php_admin_value[upload_max_filesize] = 50000000
# php_admin_value[post_max_size] = 50000000
configFile = ''
<?php // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'pgsql';
$CFG->dblibrary = 'native';
$CFG->dbhost = '${env.postgresql.host}';
$CFG->dbname = '${env.postgresql.database}';
$CFG->dbuser = '${env.postgresql.user}';
$CFG->dbpass = '${env.postgresql.password}';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => '${env.postgreesql.port}',
'dbsocket' => '${env.postgresql.password}',
);
$CFG->wwwroot = 'https://www.saison-photo.org';
$CFG->dataroot = '${varDir}';
$CFG->admin = 'admin';
$CFG->directorypermissions = 02777;
require_once(__DIR__ . '/lib/setup.php');
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!
'';
in {
options.services.myWebsites.Emilia = {
production = {
enable = lib.mkEnableOption "enable Emilia's website";
};
};
config = lib.mkIf cfg.production.enable {
security.acme.certs."emilia" = config.services.myCertificates.certConfig // {
domain = "saison-photo.org";
extraDomains = {
"www.saison-photo.org" = null;
};
};
system.activationScripts.emilia = ''
install -m 0755 -o wwwrun -g wwwrun -d ${varDir}
'';
services.myWebsites.production.vhostConfs.emilia = {
certName = "emilia";
hosts = [ "saison-photo.org" "www.saison-photo.org" ];
root = siteDir;
extraConfig = [
''
<Directory ${siteDir}>
DirectoryIndex pause.html
Options Indexes FollowSymLinks MultiViews Includes
Require all granted
</Directory>
''
];
};
};
}
|