{ lib, pkgs, config, myconfig, mylibs, ... }:
let
cfg = config.services.myWebsites.Capitaines;
env = myconfig.env.websites.capitaines;
webappName = "capitaines_mastodon";
root = "/run/current-system/webapps/${webappName}";
siteDir = ./mastodon_static;
in {
options.services.myWebsites.Capitaines = {
production = {
enable = lib.mkEnableOption "enable Capitaines's website";
};
};
config = lib.mkIf cfg.production.enable {
security.acme.certs."capitaines" = config.services.myCertificates.certConfig // {
domain = "mastodon.capitaines.fr";
extraDomains = { "capitaines.fr" = null; };
};
system.extraSystemBuilderCmds = ''
mkdir -p $out/webapps
ln -s ${siteDir} $out/webapps/${webappName}
'';
services.myWebsites.production.vhostConfs.capitaines_mastodon = {
certName = "capitaines";
hosts = [ "mastodon.capitaines.fr" ];
root = root;
extraConfig = [
''
ErrorDocument 404 /index.html
DirectoryIndex index.html
Options Indexes FollowSymLinks MultiViews Includes
Require all granted
''
];
};
services.myWebsites.production.vhostConfs.capitaines = {
certName = "capitaines";
hosts = [ "capitaines.fr" ];
root = "/run/current-system/webapps/_www";
extraConfig = [ ''
DirectoryIndex index.htm
Require all granted
'' ];
};
};
}