blob: 6f58d3cab8b5dbcb2523dea287c4aa4395502680 (
plain) (
tree)
|
|
{ lib, pkgs, config, myconfig, mylibs, ... }:
let
aten = pkgs.callPackage ./aten.nix { inherit (mylibs) fetchedGitPrivate yarn2nixPackage; };
aten_dev = aten {
config = myconfig.env.websites.aten.integration;
};
aten_prod = aten {
config = myconfig.env.websites.aten.production;
};
cfg = config.services.myWebsites.Aten;
in {
options.services.myWebsites.Aten = {
production = {
enable = lib.mkEnableOption "enable Aten's website in production";
};
integration = {
enable = lib.mkEnableOption "enable Aten's website in integration";
};
};
imports = [
../commons/stats.nix
];
config = lib.mkMerge [
(lib.mkIf cfg.production.enable {
mySecrets.keys = aten_prod.keys;
services.myWebsites.commons.stats.enable = true;
services.myWebsites.commons.stats.sites = [
{
name = "aten.pro";
conf = ./goaccess.conf;
}
];
security.acme.certs."aten" = config.services.myCertificates.certConfig // {
domain = "aten.pro";
extraDomains = {
"www.aten.pro" = null;
};
};
services.myPhpfpm.preStart.aten_prod = aten_prod.phpFpm.preStart;
services.myPhpfpm.serviceDependencies.aten_prod = aten_prod.phpFpm.serviceDeps;
services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool;
system.activationScripts.aten_prod = aten_prod.activationScript;
system.extraSystemBuilderCmds = ''
mkdir -p $out/webapps
ln -s ${aten_prod.webRoot} $out/webapps/${aten_prod.apache.webappName}
'';
services.myWebsites.apacheConfig.aten_prod.modules = aten_prod.apache.modules;
services.myWebsites.production.modules = aten_prod.apache.modules;
services.myWebsites.production.vhostConfs.aten = {
certName = "aten";
hosts = [ "aten.pro" "www.aten.pro" ];
root = aten_prod.apache.root;
extraConfig = [ aten_prod.apache.vhostConf ];
};
})
(lib.mkIf cfg.integration.enable {
mySecrets.keys = aten_dev.keys;
security.acme.certs."eldiron".extraDomains."dev.aten.pro" = null;
services.myPhpfpm.preStart.aten_dev = aten_dev.phpFpm.preStart;
services.myPhpfpm.serviceDependencies.aten_dev = aten_dev.phpFpm.serviceDeps;
services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool;
system.activationScripts.aten_dev = aten_dev.activationScript;
system.extraSystemBuilderCmds = ''
mkdir -p $out/webapps
ln -s ${aten_dev.webRoot} $out/webapps/${aten_dev.apache.webappName}
'';
services.myWebsites.integration.modules = aten_dev.apache.modules;
services.myWebsites.integration.vhostConfs.aten = {
certName = "eldiron";
hosts = [ "dev.aten.pro" ];
root = aten_dev.apache.root;
extraConfig = [ aten_dev.apache.vhostConf ];
};
})
];
}
|