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