]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/capitaines/default.nix
80739556030568c07b9fb11e3d0e06cdfa7f6a4f
[perso/Immae/Config/Nix.git] / nixops / modules / websites / capitaines / default.nix
1 { lib, pkgs, config, myconfig, mylibs, ... }:
2 let
3 cfg = config.services.myWebsites.Capitaines;
4 env = myconfig.env.websites.capitaines;
5 webappName = "capitaines_mastodon";
6 root = "/run/current-system/webapps/${webappName}";
7 siteDir = ./mastodon_static;
8 in {
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 {
16 security.acme.certs."capitaines_mastodon" = config.services.myCertificates.certConfig // {
17 domain = "mastodon.capitaines.fr";
18 };
19 system.extraSystemBuilderCmds = ''
20 mkdir -p $out/webapps
21 ln -s ${siteDir} $out/webapps/${webappName}
22 '';
23
24 services.myWebsites.production.vhostConfs.capitaines = {
25 certName = "capitaines_mastodon";
26 hosts = [ "mastodon.capitaines.fr" ];
27 root = root;
28 extraConfig = [
29 ''
30 ErrorDocument 404 /index.html
31 <Directory ${root}>
32 DirectoryIndex index.html
33 Options Indexes FollowSymLinks MultiViews Includes
34 Require all granted
35 </Directory>
36 ''
37 ];
38 };
39 };
40 }