Home

infra @9e9d01d3a7a385ef214288b72455566d67ec9155 - refs - log -
-
https://git.jolheiser.com/infra.git
dragonwell flake
infra / dragonwell / services / soju.nix
- 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
{ jolheiser, lib, ... }:
let
  baseCertPath = "/var/lib/acme/${host}";
  port = 7658;
  host = "irc.${jolheiser.domain}";
in
{
  security.acme = {
    acceptTerms = true;
    email = "irc@jolheiser.com";
    certs."${host}" = {
      listenHTTP = ":${builtins.toString port}";
      postRun = "systemctl reload soju";
      group = "soju";
    };
  };
  services = {
    soju = {
      enable = true;
      tlsCertificate = "${baseCertPath}/fullchain.pem";
      tlsCertificateKey = "${baseCertPath}/key.pem";
    };
    caddy.virtualHosts."${host}".extraConfig = ''
      reverse_proxy localhost:${builtins.toString port}
    '';
  };
  systemd.services.soju.serviceConfig = {
    DynamicUser = lib.mkForce false;
    User = "soju";
    Group = "soju";
    ReadOnlyPaths = baseCertPath;
  };
  users = {
    users.soju = {
      isSystemUser = true;
      group = "soju";
    };
    groups.soju = { };
  };
}