about summary refs log tree commit diff
path: root/modules/rss-bridge.nix
blob: c890872754577cb4f916c20985e404314c8e35f3 (plain) (blame)
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
{
  config,
  lib,
  libNginx,
  ...
}:
with lib;
let
  cfg = config.nixfiles.modules.rss-bridge;
in
{
  options.nixfiles.modules.rss-bridge = {
    enable = mkEnableOption "RSS-Bridge";

    domain = mkOption {
      description = "Domain name sans protocol scheme.";
      type = with types; str;
      default = "rss-bridge.${config.networking.domain}";
    };
  };

  config = mkIf cfg.enable {
    ark.directories = [ config.services.rss-bridge.dataDir ];

    nixfiles.modules.nginx = {
      enable = true;
      virtualHosts.${cfg.domain}.extraConfig = libNginx.config.internalOnly;
    };

    services.rss-bridge = {
      enable = true;
      virtualHost = cfg.domain;
      config = {
        system.enabled_bridges = [ "*" ];
        FileCache = {
          path = "${config.services.rss-bridge.dataDir}/cache";
          enable_purge = true;
        };
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3