all repos — nixfiles @ 7fc398dded782164e47cc201405cf36570e5d8ff

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

system/roles/sso.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
{
  config,
  ...
}:
let
  domain = config.networking.domain;
in
{
  age.secrets.pocket-id.file = ../../secrets/pocket-id.age;

  services.pocket-id = {
    enable = true;
    environmentFile = config.age.secrets.pocket-id.path;
    settings = {
      APP_URL = "https://id.${domain}";
      TRUST_PROXY = true;
    };
  };

  services.caddy.virtualHosts = {
    "id.${domain}" = {
      extraConfig = ''
        encode zstd gzip
        reverse_proxy 127.0.0.1:1411
      '';
    };
    "iam.${domain}" = {
      extraConfig = ''
        redir https://id.${domain}{uri} permanent
      '';
    };
  };
}