summaryrefslogtreecommitdiff
path: root/modules/nixos/mixins/miniflux.nix
blob: 187ddc05c3121c33b5846aafaf6a03601c732786 (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
47
{
  config,
  lib,
  secretsDir,
  ...
}:

{
  config = lib.mkMerge [
    {
      services.miniflux = {
        adminCredentialsFile = config.age.secrets.miniflux.path;
        config = {
          BASE_URL = "https://miniflux.${config.networking.domain}";
          LISTEN_ADDR = "localhost:7000";
        };
      };
    }

    (lib.mkIf config.services.miniflux.enable {
      age.secrets.miniflux.file = secretsDir + "/miniflux.age";

      services = {
        nginx.virtualHosts.${lib.removePrefix "https://" config.services.miniflux.config.BASE_URL} = {
          locations."/" = {
            proxyPass = "http://${config.services.miniflux.config.LISTEN_ADDR}";
          };
        };
      };

      /*
        # Create the socket manually to ensure NGINX has permission for the socket's parent directory
        # ...since for some reason Miniflux will not give it the same `0777` permission as the socket itself
        systemd = {
          services.miniflux = {
            requires = [ "miniflux.socket" ];
          };

          sockets.miniflux = {
            wantedBy = [ "sockets.target" ];
            listenStreams = [ "/run/miniflux.sock" ];
          };
        };
      */
    })
  ];
}