summaryrefslogtreecommitdiff
path: root/modules/login.nix
blob: d2a6de38678b08b117fb33a669563c07c33da2e1 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ config, lib, pkgs, ... }:
let
  cfg = config.orbekk.login;
  aliases = import ../data/aliases.nix;
in
{
  options = {
    orbekk.login = {
      enable = lib.mkEnableOption "Enable login server";
      loginPort = lib.mkOption {
        type = lib.types.int;
        default = aliases.services.login.port;
      };
      loginDomain = lib.mkOption {
        type = lib.types.str;
        default = "login.orbekk.com";
      };
    };
  };

  config = lib.mkIf cfg.enable {
    services.keycloak = {
      enable = false;
      httpPort = "8080";
      bindAddress = "127.0.0.1";
      database.type = "postgresql";
      database.passwordFile = "/opt/secret/keycloak/db_password";
      frontendUrl = "http://localhost/auth";
    };

    environment.systemPackages = with pkgs; [
      xmlstarlet
      libtidy
      jq
    ];

    # services.nginx.virtualHosts.${cfg.loginDomain} = {
    #   enableACME = true;
    #   forceSSL = true;
    #   locations."/" = {
    #     proxyPass = "http://127.0.0.1:${toString cfg.loginPort}";
    #     proxyWebsockets = true;
    #   };
    # };
  };
}