blob: 2a1271b4205601beb534e6f78cfb61d24c4a065d (
plain) (
tree)
|
|
{ lib, pkgs, config, myconfig, mylibs, ... }:
let
piedsjaloux_dev = pkgs.callPackage ./piedsjaloux.nix {
inherit (pkgs.private.webapps) piedsjaloux;
config = myconfig.env.websites.piedsjaloux.integration;
};
piedsjaloux_prod = pkgs.callPackage ./piedsjaloux.nix {
inherit (pkgs.private.webapps) piedsjaloux;
config = myconfig.env.websites.piedsjaloux.production;
};
cfg = config.services.myWebsites.PiedsJaloux;
in {
options.services.myWebsites.PiedsJaloux = {
production = {
enable = lib.mkEnableOption "enable PiedsJaloux's website in production";
};
integration = {
enable = lib.mkEnableOption "enable PiedsJaloux's website in integration";
};
};
config = lib.mkMerge [
(lib.mkIf cfg.production.enable {
secrets.keys = piedsjaloux_prod.keys;
services.webstats.sites = [ { name = "piedsjaloux.fr"; } ];
security.acme.certs."piedsjaloux" = config.services.myCertificates.certConfig // {
domain = "piedsjaloux.fr";
extraDomains = {
"www.piedsjaloux.fr" = null;
};
};
services.myPhpfpm.preStart.piedsjaloux_prod = piedsjaloux_prod.phpFpm.preStart;
services.myPhpfpm.serviceDependencies.piedsjaloux_prod = piedsjaloux_prod.phpFpm.serviceDeps;
services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool;
system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript;
system.extraSystemBuilderCmds = ''
mkdir -p $out/webapps
ln -s ${piedsjaloux_prod.app.webRoot} $out/webapps/${piedsjaloux_prod.apache.webappName}
'';
services.myWebsites.production.modules = piedsjaloux_prod.apache.modules;
services.myWebsites.production.vhostConfs.piedsjaloux = {
certName = "piedsjaloux";
hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
root = piedsjaloux_prod.apache.root;
extraConfig = [ piedsjaloux_prod.apache.vhostConf ];
};
})
(lib.mkIf cfg.integration.enable {
secrets.keys = piedsjaloux_dev.keys;
security.acme.certs."eldiron".extraDomains."piedsjaloux.immae.eu" = null;
services.myPhpfpm.preStart.piedsjaloux_dev = piedsjaloux_dev.phpFpm.preStart;
services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux_dev.phpFpm.serviceDeps;
services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool;
system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript;
system.extraSystemBuilderCmds = ''
mkdir -p $out/webapps
ln -s ${piedsjaloux_dev.app.webRoot} $out/webapps/${piedsjaloux_dev.apache.webappName}
'';
services.myWebsites.integration.modules = piedsjaloux_dev.apache.modules;
services.myWebsites.integration.vhostConfs.piedsjaloux = {
certName = "eldiron";
hosts = [ "piedsjaloux.immae.eu" ];
root = piedsjaloux_dev.apache.root;
extraConfig = [ piedsjaloux_dev.apache.vhostConf ];
};
})
];
}
|