12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- { config, lib, ... }:
- with lib;
- let
- cfg = config.roles.server.miniflux;
- in {
- options.roles.server.miniflux = {
- enable = mkOption {
- default = false;
- type = types.bool;
- };
- domain = mkOption {
- default = config.roles.server.domain;
- type = types.str;
- };
- adminCredentialsFile = mkOption {
- default = "${pkgs.writeText "minifluxPass" ''
- ADMIN_USERNAME="admin"
- ADMIN_PASSWORD="password"
- ''}";
- type = types.str;
- };
- pollingFrequency = mkOption {
- default = "30";
- type = types.str;
- };
- };
- config = mkIf cfg.enable {
- roles.server.nginx.enable = mkForce true;
- systemd.services.miniflux.serviceConfig.RuntimeDirectoryMode = lib.mkForce "0755";
- services = {
- miniflux = {
- enable = true;
- inherit (cfg) adminCredentialsFile;
- config = {
- LISTEN_ADDR = "/run/miniflux/miniflux.sock";
- POLLING_FREQUENCY = cfg.pollingFrequency;
- BASE_URL = "https://rss." + cfg.domain;
- };
- };
- nginx = {
- upstreams.miniflux.servers = { "unix:${config.services.miniflux.config.LISTEN_ADDR}" = {}; };
- virtualHosts."rss.${cfg.domain}" = {
- forceSSL = true;
- useACMEHost = cfg.domain;
- locations."/".proxyPass = "http://miniflux";
- };
- };
- };
- };
- }
|