1 { lib, config, pkgs, ... }:
3 cfg = config.myServices.websites.emilia.richie_production;
4 vardir = "/var/lib/richie_production";
5 richieSrc = pkgs.stdenv.mkDerivation (pkgs.mylibs.fetchedGitPrivate ./richie.json // {
6 phases = "installPhase";
10 ln -sf ${vardir}/files $out/
11 ln -sf ${vardir}/drapeaux $out/images/
12 ln -sf ${vardir}/photos $out/
13 sed -i "s@localedef --list-archive@localedef --list-archive /run/current-system/sw/lib/locale/locale-archive@" $out/admin/parametres.php
18 options.myServices.websites.emilia.richie_production.enable = lib.mkEnableOption "enable Richie's website";
19 config = lib.mkIf cfg.enable {
20 services.duplyBackup.profiles.richie_production.rootDir = vardir;
21 services.webstats.sites = [ { name = "europe-richie.org"; } ];
24 dest = "webapps/prod-richie";
28 text = with config.myEnv.websites.richie; ''
31 $hote_sql = '${mysql.host}';
32 $login_sql = '${mysql.user}';
33 $bdd_sql = '${mysql.database}';
34 $mdp_sql = '${mysql.password}';
36 $db = mysqli_connect($hote_sql,$login_sql,$mdp_sql);
39 $smtp_mailer->Auth('${smtp_mailer.user}', '${smtp_mailer.password}');
43 myServices.websites.webappDirs.richie_production = richieSrc;
44 system.activationScripts.richie_production = {
47 install -m 0755 -o wwwrun -g wwwrun -d /var/lib/php/sessions/richie_production
48 install -m 0755 -o wwwrun -g wwwrun -d ${vardir}
51 services.phpfpm.pools.richie_production = {
52 listen = "/run/phpfpm/richie_production.sock";
61 pm.process_idle_timeout = 60
63 env[PATH] = /run/current-system/sw/bin:${lib.makeBinPath [ pkgs.imagemagick ]}
64 env[BDD_CONNECT] = "/var/secrets/webapps/prod-richie"
65 php_admin_value[open_basedir] = "${vardir}:/var/lib/php/sessions/richie_production:/var/secrets/webapps/prod-richie:${richieSrc}:/tmp"
66 php_admin_value[session.save_path] = "/var/lib/php/sessions/richie_production"
68 phpOptions = config.services.phpfpm.phpOptions + ''
69 date.timezone = 'Europe/Paris'
70 extension=${pkgs.php}/lib/php/extensions/mysqli.so
73 services.websites.env.production.modules = [ "proxy_fcgi" ];
74 services.websites.env.production.vhostConfs.richie_production = {
77 certMainHost = "europe-richie.org";
78 hosts = [ "europe-richie.org" "www.europe-richie.org" ];
79 root = "/run/current-system/webapps/richie_production";
82 Use Stats europe-richie.org
83 ErrorDocument 404 /404.html
84 <LocationMatch "^/files/.*/admin/">
87 <Directory /run/current-system/webapps/richie_production>
88 DirectoryIndex index.php index.htm index.html
89 Options Indexes FollowSymLinks MultiViews Includes
94 SetHandler "proxy:unix:/run/phpfpm/richie_production.sock|fcgi://localhost"