all repos — nixfiles @ ef68d595e55e20088263622c5bdc4100a2480b44

System and user configuration, managed by nix and home-manager

system/roles/opia/calendar.nix (view raw)

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
{ config, pkgs, ... }:
let
  domain = "opia.ovh";
  subdomain = "cal";
in
{
  age.secrets.lauti.file = ../../../secrets/lauti.age;

  services.lauti = {
    enable = true;
    settings = {
      LAUTI_ADDR = "localhost:3333";
      LAUTI_MAIL_ADDRESS = "lauti@${domain}";
      LAUTI_ADMIN_EMAIL = "lauti@${domain}";
      LAUTI_TIMEZONE = config.time.timeZone;
      LAUTI_BASE_URL = "https://${subdomain}.${domain}";
      # LAUTI_ADMIN_PASSWORD = in secret
    };
    secrets = [ config.age.secrets.lauti.path ];
  };
  # for debugging the database
  environment.systemPackages = with pkgs; [ litecli ];

  services.caddy = {
    virtualHosts."${subdomain}.${domain}" = {
      extraConfig = ''
        tls {
          dns_challenge_override_domain _acme-challenge.${subdomain}.opia.${config.networking.domain}
        }
        encode zstd gzip

        reverse_proxy ${config.services.lauti.settings.LAUTI_ADDR} {
          header_up -Accept-Encoding
          transport http {
            compression off
          }
        }
      '';
    };
  };
}