]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/capitaines/default.nix
Start moving websites configuration to modules
[perso/Immae/Config/Nix.git] / nixops / modules / websites / capitaines / default.nix
CommitLineData
8a964143 1{ lib, pkgs, config, myconfig, ... }:
10bd8c08
IB
2let
3 cfg = config.services.myWebsites.Capitaines;
4 env = myconfig.env.websites.capitaines;
7da3ceec
IB
5 webappName = "capitaines_mastodon";
6 root = "/run/current-system/webapps/${webappName}";
10bd8c08
IB
7 siteDir = ./mastodon_static;
8in {
9 options.services.myWebsites.Capitaines = {
10 production = {
11 enable = lib.mkEnableOption "enable Capitaines's website";
12 };
13 };
14
15 config = lib.mkIf cfg.production.enable {
eb190677 16 security.acme.certs."capitaines" = config.services.myCertificates.certConfig // {
10bd8c08 17 domain = "mastodon.capitaines.fr";
eb190677 18 extraDomains = { "capitaines.fr" = null; };
10bd8c08 19 };
7da3ceec
IB
20 system.extraSystemBuilderCmds = ''
21 mkdir -p $out/webapps
22 ln -s ${siteDir} $out/webapps/${webappName}
23 '';
10bd8c08 24
daf64e3f 25 services.websites.production.vhostConfs.capitaines_mastodon = {
eb190677 26 certName = "capitaines";
10bd8c08 27 hosts = [ "mastodon.capitaines.fr" ];
7da3ceec 28 root = root;
10bd8c08
IB
29 extraConfig = [
30 ''
31 ErrorDocument 404 /index.html
7da3ceec 32 <Directory ${root}>
10bd8c08
IB
33 DirectoryIndex index.html
34 Options Indexes FollowSymLinks MultiViews Includes
35 Require all granted
36 </Directory>
37 ''
38 ];
39 };
eb190677 40
daf64e3f 41 services.websites.production.vhostConfs.capitaines = {
eb190677
IB
42 certName = "capitaines";
43 hosts = [ "capitaines.fr" ];
44 root = "/run/current-system/webapps/_www";
45 extraConfig = [ ''
46 <Directory /run/current-system/webapps/_www>
47 DirectoryIndex index.htm
48 Require all granted
49 </Directory>
50 '' ];
51 };
10bd8c08
IB
52 };
53}