aboutsummaryrefslogtreecommitdiff
path: root/nix/web.nix
blob: 3f85d8499e0d0da43a80f8177f66242b790a762b (plain)
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
{ inputs, pkgs, ... }:
let
  domain = "kassouni.net";
in
{
  services.nginx = {
    enable = true;
    recommendedGzipSettings = true;
    recommendedOptimisation = true;
    recommendedProxySettings = true;
    recommendedTlsSettings = true;

    virtualHosts = {
      # dont serve kassouni.net traffic to other subdomains
      "_" = {
        default = true;
        rejectSSL = true;
        locations."/".return = 444;
      };

      ${domain} = {
        forceSSL = true;
        enableACME = true;
        root = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.website;
      };
    };
  };

  security.acme = {
    acceptTerms = true;
    defaults.email = "alex@${domain}";
  };

  networking.firewall.allowedTCPPorts = [
    80
    443
  ];
}