1{
2 config,
3 lib,
4 self,
5 ...
6}: let
7 name = "miniflux";
8 cfg = config.myNixOS.services.${name};
9
10 network = config.mySnippets.tailnet;
11 service = network.networkMap.${name};
12in {
13 options.myNixOS.services.${name} = {
14 enable = lib.mkEnableOption "${name} server";
15 autoProxy = lib.mkOption {
16 default = true;
17 example = false;
18 description = "${name} auto proxy";
19 type = lib.types.bool;
20 };
21 };
22
23 config = lib.mkIf cfg.enable {
24 age.secrets.miniflux.file = "${self.inputs.secrets}/miniflux.age";
25
26 myNixOS.services.postgresql.enable = true;
27
28 services = {
29 caddy.virtualHosts."${service.vHost}".extraConfig = lib.mkIf cfg.autoProxy ''
30 bind tailscale/${name}
31 encode zstd gzip
32 reverse_proxy ${service.hostName}:${toString service.port}
33 '';
34
35 miniflux = {
36 enable = true;
37 adminCredentialsFile = config.age.secrets.miniflux.path;
38 createDatabaseLocally = true;
39 config = {
40 BATCH_SIZE = 100;
41 CLEANUP_FREQUENCY_HOURS = 48;
42 LISTEN_ADDR = "${service.hostName}:${toString service.port}";
43 BASE_URL = "https://${service.vHost}";
44 };
45 };
46 };
47 };
48}