Personal-use NixOS configuration
1{
2 hosts ? [ ],
3}:
4
5{ config, flakeLib, ... }:
6
7{
8 imports = [
9 ../databases/postgresql.nix
10 ];
11
12 services.wakapi = {
13 enable = true;
14
15 settings = {
16 app = {
17 leaderboard_enabled = false;
18
19 inactive_days = 31;
20 max_inactive_months = -1;
21 };
22
23 mail = {
24 smtp = {
25 port = 465;
26 tls = true;
27 };
28 };
29
30 server = {
31 listen_ipv4 = "-";
32 listen_ipv6 = "-";
33 listen_socket = "/run/wakapi/wakapi.sock";
34 };
35
36 db = {
37 user = "wakapi";
38 name = "wakapi";
39
40 dialect = config.services.wakapi.database.dialect;
41
42 socket = "/run/postgres"; # config.services.postgresql.settings.socket; # TODO: This causes infinite recursion
43 };
44
45 security = {
46 allow_signup = false;
47 invite_codes = false;
48 signup_captcha = true;
49
50 disable_frontpage = true;
51
52 insecure_cookies = false;
53 };
54 };
55
56 database = {
57 dialect = "postgres";
58
59 createLocally = true;
60 };
61 };
62
63 # Caddy reverse proxy configuration
64 services.caddy.virtualHosts = flakeLib.mkProxies hosts ''
65 reverse_proxy unix/${config.services.wakapi.settings.server.listen_socket}
66 '';
67}