]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/capitaines/default.nix
Move production websites to use stable web directories
[perso/Immae/Config/Nix.git] / nixops / modules / websites / capitaines / default.nix
CommitLineData
10bd8c08
IB
1{ lib, pkgs, config, myconfig, mylibs, ... }:
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 {
16 security.acme.certs."capitaines_mastodon" = config.services.myCertificates.certConfig // {
17 domain = "mastodon.capitaines.fr";
18 };
7da3ceec
IB
19 system.extraSystemBuilderCmds = ''
20 mkdir -p $out/webapps
21 ln -s ${siteDir} $out/webapps/${webappName}
22 '';
10bd8c08
IB
23
24 services.myWebsites.production.vhostConfs.capitaines = {
25 certName = "capitaines_mastodon";
26 hosts = [ "mastodon.capitaines.fr" ];
7da3ceec 27 root = root;
10bd8c08
IB
28 extraConfig = [
29 ''
30 ErrorDocument 404 /index.html
7da3ceec 31 <Directory ${root}>
10bd8c08
IB
32 DirectoryIndex index.html
33 Options Indexes FollowSymLinks MultiViews Includes
34 Require all granted
35 </Directory>
36 ''
37 ];
38 };
39 };
40}