From f8026b6e4c869aa108f6361c8ccd50890657994d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 18 May 2019 10:49:00 +0200 Subject: Move personal websites to modules --- modules/private/websites/emilia/moodle/pause.html | 48 ++++++++++++++++ modules/private/websites/emilia/production.nix | 69 +++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 modules/private/websites/emilia/moodle/pause.html create mode 100644 modules/private/websites/emilia/production.nix (limited to 'modules/private/websites/emilia') diff --git a/modules/private/websites/emilia/moodle/pause.html b/modules/private/websites/emilia/moodle/pause.html new file mode 100644 index 0000000..8b99c59 --- /dev/null +++ b/modules/private/websites/emilia/moodle/pause.html @@ -0,0 +1,48 @@ + + + + Pause + + + + +
+

Site web en pause !

+
+

Le site et les cours de photographie sont actuellement en pause.

+
+
+ + diff --git a/modules/private/websites/emilia/production.nix b/modules/private/websites/emilia/production.nix new file mode 100644 index 0000000..2e705a1 --- /dev/null +++ b/modules/private/websites/emilia/production.nix @@ -0,0 +1,69 @@ +{ lib, pkgs, config, myconfig, ... }: +let + cfg = config.myServices.websites.emilia.production; + env = myconfig.env.websites.emilia; + varDir = "/var/lib/moodle"; + siteDir = ./moodle; + webappName = "emilia_moodle"; + root = "/run/current-system/webapps/${webappName}"; + # php_admin_value[upload_max_filesize] = 50000000 + # php_admin_value[post_max_size] = 50000000 + configFile = '' + 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.myServices.websites.emilia.production.enable = lib.mkEnableOption "enable Emilia's website"; + + config = lib.mkIf cfg.enable { + system.activationScripts.emilia = '' + install -m 0755 -o wwwrun -g wwwrun -d ${varDir} + ''; + system.extraSystemBuilderCmds = '' + mkdir -p $out/webapps + ln -s ${siteDir} $out/webapps/${webappName} + ''; + services.websites.production.vhostConfs.emilia = { + certName = "emilia"; + certMainHost = "saison-photo.org"; + hosts = [ "saison-photo.org" "www.saison-photo.org" ]; + root = root; + extraConfig = [ + '' + + DirectoryIndex pause.html + Options Indexes FollowSymLinks MultiViews Includes + Require all granted + + '' + ]; + }; + }; +} -- cgit v1.2.3