From 5e2c33066e3ab73a103e9efa52319ccf33bcbb58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 28 Jun 2022 23:04:34 +0200 Subject: [PATCH] Install dolibarr for nicecoop --- modules/private/default.nix | 1 + modules/private/websites/default.nix | 1 + .../nicecoop/dolibarr_integration.nix | 62 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 modules/private/websites/nicecoop/dolibarr_integration.nix diff --git a/modules/private/default.nix b/modules/private/default.nix index 4c55655..d2a11d0 100644 --- a/modules/private/default.nix +++ b/modules/private/default.nix @@ -79,6 +79,7 @@ set = { nicecoopGestionCompte = ./websites/nicecoop/gestion-compte.nix; nicecoopGestionCompteIntegration = ./websites/nicecoop/gestion-compte_integration.nix; nicecoopOdoo = ./websites/nicecoop/odoo.nix; + nicecoopDolibarrDev = ./websites/nicecoop/dolibarr_integration.nix; nicecoopCopanier = ./websites/nicecoop/copanier.nix; noctambulesCloud = ./websites/noctambules/cloud.nix; diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index d636678..5920fbe 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix @@ -295,6 +295,7 @@ in gestion-compte.enable = true; gestion-compte-integration.enable = true; odoo.enable = true; + dolibarrDev.enable = true; copanier.enable = true; }; diff --git a/modules/private/websites/nicecoop/dolibarr_integration.nix b/modules/private/websites/nicecoop/dolibarr_integration.nix new file mode 100644 index 0000000..f6cb03b --- /dev/null +++ b/modules/private/websites/nicecoop/dolibarr_integration.nix @@ -0,0 +1,62 @@ +{ lib, config, pkgs, ... }: +let + cfg = config.myServices.websites.nicecoop.dolibarrDev; + varDir = "/var/lib/ftp/nicecoop/dolibarr_dev"; + apacheUser = config.services.httpd.Inte.user; + apacheGroup = config.services.httpd.Inte.group; +in { + options.myServices.websites.nicecoop.dolibarrDev.enable = lib.mkEnableOption "enable Dolibarr website"; + + config = lib.mkIf cfg.enable { + system.activationScripts.dolibarr = { + deps = [ "httpd" "users" ]; + text = '' + install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/nicecoop + ''; + }; + services.phpfpm.pools.nicecoop_dolibarr_dev = { + user = apacheUser; + group = apacheGroup; + settings = { + "listen.owner" = apacheUser; + "listen.group" = apacheGroup; + + "pm" = "ondemand"; + "pm.max_children" = "5"; + "pm.process_idle_timeout" = "60"; + + "php_admin_value[upload_max_filesize]" = "100M"; + "php_admin_value[post_max_size]" = "100M"; + "php_admin_value[open_basedir]" = "/var/lib/php/sessions/nicecoop:${varDir}:/tmp"; + "php_admin_value[session.save_path]" = "/var/lib/php/sessions/nicecoop"; + }; + phpOptions = config.services.phpfpm.phpOptions + '' + disable_functions = "mail" + ''; + phpPackage = pkgs.php74; + }; + services.websites.env.production.modules = [ "proxy_fcgi" ]; + services.websites.env.integration.vhostConfs.nicecoop_dolibarr_dev = { + certName = "integration"; + addToCerts = true; + hosts = ["dolibarr.nc.immae.dev"]; + root = "${varDir}/dolibarr/htdocs"; + extraConfig = [ + '' + + SetHandler "proxy:unix:${config.services.phpfpm.pools.nicecoop_dolibarr_dev.socket}|fcgi://localhost" + + + + DirectoryIndex index.php index.htm index.html + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride All + Require all granted + + '' + ]; + }; + }; +} + + -- 2.41.0