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