]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/capitaines/production.nix
Move personal websites to modules
[perso/Immae/Config/Nix.git] / modules / private / websites / capitaines / production.nix
CommitLineData
8a964143 1{ lib, pkgs, config, myconfig, ... }:
10bd8c08 2let
f8026b6e 3 cfg = config.myServices.websites.capitaines.production;
10bd8c08 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 {
f8026b6e 9 options.myServices.websites.capitaines.production.enable = lib.mkEnableOption "enable Capitaines's website";
10bd8c08 10
f8026b6e 11 config = lib.mkIf cfg.enable {
7da3ceec
IB
12 system.extraSystemBuilderCmds = ''
13 mkdir -p $out/webapps
14 ln -s ${siteDir} $out/webapps/${webappName}
15 '';
10bd8c08 16
daf64e3f 17 services.websites.production.vhostConfs.capitaines_mastodon = {
7df420c2
IB
18 certName = "capitaines";
19 certMainHost = "mastodon.capitaines.fr";
20 hosts = [ "mastodon.capitaines.fr" ];
21 root = root;
22 extraConfig = [
10bd8c08
IB
23 ''
24 ErrorDocument 404 /index.html
7da3ceec 25 <Directory ${root}>
10bd8c08
IB
26 DirectoryIndex index.html
27 Options Indexes FollowSymLinks MultiViews Includes
28 Require all granted
29 </Directory>
30 ''
31 ];
32 };
eb190677 33
daf64e3f 34 services.websites.production.vhostConfs.capitaines = {
7df420c2
IB
35 certName = "capitaines";
36 addToCerts = true;
37 hosts = [ "capitaines.fr" ];
38 root = "/run/current-system/webapps/_www";
eb190677
IB
39 extraConfig = [ ''
40 <Directory /run/current-system/webapps/_www>
41 DirectoryIndex index.htm
42 Require all granted
43 </Directory>
44 '' ];
45 };
10bd8c08
IB
46 };
47}