aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/caddy.nix
blob: 77a1891e0eb9c094f7cfa1ea2139e9881fe7dd11 (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
{
  pkgs,
  lib,
  config,
  ...
}: let
  cfg = config.collinux.services.caddy;
in
  lib.mkIf cfg.enable {
    networking.firewall.allowedTCPPorts = [80 443];
    environment.systemPackages = [pkgs.nss.tools]; # required for caddy https stuff

    services.caddy = {
      enable = true;
      environmentFile = cfg.envFile;
      extraConfig = ''
        (internal) {
          @outside not remote_ip 10.100.0.0/24 192.168.50.0/24
          abort @outside
          tls internal
        }
      '';
    };
  }