summaryrefslogtreecommitdiff
path: root/os/cez/modules/www.nix
blob: 9ec20da6d0318e78b29a0b6990343a8b088d9ac1 (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
43
44
45
46
{ config, pkgs, lib, ... }:

let
  domain = config.global.userdata.domain;
in
{
  services.nginx = { 
    enable = true;

    recommendedTlsSettings = true;
    recommendedOptimisation = true;
    recommendedGzipSettings = true;
    recommendedProxySettings = true;
    recommendedBrotliSettings = true;

    virtualHosts.${domain} = {
        forceSSL = true;
        enableACME = true;
        useACMEHost = domain;
        locations."= /" = {
            extraConfig = "add_header Content-Type text/html;";
            return = ''200
              '<!DOCTYPE html>
              <html lang="en">
                <head>
                  <meta charset="UTF-8">
                  <title>Nix Cache</title>
                </head>
                <body>
                  <center>
                    <h1 style="font-size: 8em">
                      ❄️ Nix Cache
                    </h1>
                    <p style="font-weight: bold">
                      Public Key: nixbin.sinanmohd.com:dXV3KDPVrm+cGJ2M1ZmTeQJqFGaEapqiVoWHgYDh03k=
                    </p>
                  </center>
                </body>
              </html>'
            '';
          };
      };

    };
  };
}