]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/capitaines/default.nix
Add certificate creation and handling to websites
[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 {
7da3ceec
IB
16 system.extraSystemBuilderCmds = ''
17 mkdir -p $out/webapps
18 ln -s ${siteDir} $out/webapps/${webappName}
19 '';
10bd8c08 20
daf64e3f 21 services.websites.production.vhostConfs.capitaines_mastodon = {
7df420c2
IB
22 certName = "capitaines";
23 certMainHost = "mastodon.capitaines.fr";
24 hosts = [ "mastodon.capitaines.fr" ];
25 root = root;
26 extraConfig = [
10bd8c08
IB
27 ''
28 ErrorDocument 404 /index.html
7da3ceec 29 <Directory ${root}>
10bd8c08
IB
30 DirectoryIndex index.html
31 Options Indexes FollowSymLinks MultiViews Includes
32 Require all granted
33 </Directory>
34 ''
35 ];
36 };
eb190677 37
daf64e3f 38 services.websites.production.vhostConfs.capitaines = {
7df420c2
IB
39 certName = "capitaines";
40 addToCerts = true;
41 hosts = [ "capitaines.fr" ];
42 root = "/run/current-system/webapps/_www";
eb190677
IB
43 extraConfig = [ ''
44 <Directory /run/current-system/webapps/_www>
45 DirectoryIndex index.htm
46 Require all granted
47 </Directory>
48 '' ];
49 };
10bd8c08
IB
50 };
51}