aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/nath/villon.nix
blob: 57a1df574162d364535e013fd2e0fc804851e3ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ lib, pkgs, config,  ... }:
let
  cfg = config.myServices.websites.nath.villon;
  varDir = "/var/lib/ftp/nath";
  env = config.myEnv.websites.nath;
  domain = "sntvillon.immae.eu";
  apacheUser = config.services.httpd.Prod.user;
  apacheGroup = config.services.httpd.Prod.group;
in {
  options.myServices.websites.nath.villon.enable = lib.mkEnableOption "enable Nath's website";

  config = lib.mkIf cfg.enable {
    services.webstats.sites = [ { name = domain; } ];

    system.activationScripts.nath_villon = {
      deps = [ "users" ];
      text = ''
        install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir}
      '';
    };
    security.acme.certs."ftp".extraDomains."${domain}" = null;

    services.websites.env.production.vhostConfs.nath_villon = {
      certName     = "nath";
      certMainHost = domain;
      hosts        = [ domain ];
      root         = varDir;
      extraConfig  = [
        ''
        Use Stats ${domain}

        <Directory ${varDir}>
          DirectoryIndex index.htm index.html
          Options Indexes FollowSymLinks MultiViews Includes
          AllowOverride None
          Require all granted
        </Directory>
          ''
      ];
    };
  };
}