2021-02-15 18:45:04 +01:00
|
|
|
# A minimalist, opinionated feed reader
|
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.services.miniflux;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.miniflux = with lib; {
|
|
|
|
enable = mkEnableOption "Miniflux feed reader";
|
|
|
|
|
2021-09-25 12:59:24 +02:00
|
|
|
credentialsFiles = mkOption {
|
2021-02-15 18:45:04 +01:00
|
|
|
type = types.str;
|
2021-09-25 12:59:24 +02:00
|
|
|
example = "/var/lib/miniflux/creds.env";
|
|
|
|
description = ''
|
|
|
|
Credential file as an 'EnvironmentFile' (see `systemd.exec(5)`)
|
|
|
|
'';
|
2021-02-15 18:45:04 +01:00
|
|
|
};
|
|
|
|
|
2021-08-24 23:05:10 +02:00
|
|
|
port = mkOption {
|
2021-02-15 18:45:04 +01:00
|
|
|
type = types.port;
|
|
|
|
default = 9876;
|
|
|
|
example = 8080;
|
|
|
|
description = "Internal port for webui";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
# The service automatically sets up the DB
|
|
|
|
services.miniflux = {
|
|
|
|
enable = true;
|
|
|
|
|
2021-09-25 12:59:24 +02:00
|
|
|
adminCredentialsFile = cfg.credentialsFiles;
|
2021-02-15 18:45:04 +01:00
|
|
|
|
|
|
|
config = {
|
|
|
|
# Virtual hosts settings
|
2021-08-24 23:05:10 +02:00
|
|
|
BASE_URL = "https://reader.${config.networking.domain}";
|
|
|
|
LISTEN_ADDR = "localhost:${toString cfg.port}";
|
2021-02-15 18:45:04 +01:00
|
|
|
# I want fast updates
|
|
|
|
POLLING_FREQUENCY = "30";
|
|
|
|
BATCH_SIZE = "50";
|
|
|
|
# I am a hoarder
|
|
|
|
CLEANUP_ARCHIVE_UNREAD_DAYS = "-1";
|
|
|
|
CLEANUP_ARCHIVE_READ_DAYS = "-1";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-12-25 19:25:08 +01:00
|
|
|
my.services.nginx.virtualHosts = {
|
|
|
|
reader = {
|
2021-08-24 23:05:10 +02:00
|
|
|
inherit (cfg) port;
|
2023-12-25 19:25:08 +01:00
|
|
|
};
|
|
|
|
};
|
2024-09-22 01:58:56 +02:00
|
|
|
|
2021-11-03 14:43:16 +01:00
|
|
|
# FIXME: backup
|
|
|
|
# FIXME: persistence
|
|
|
|
|
2024-09-22 01:58:56 +02:00
|
|
|
services.fail2ban.jails = {
|
|
|
|
miniflux = ''
|
|
|
|
enabled = true
|
|
|
|
filter = miniflux
|
|
|
|
port = http,https
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.etc = {
|
|
|
|
"fail2ban/filter.d/miniflux.conf".text = ''
|
|
|
|
[Definition]
|
|
|
|
failregex = ^.*msg="[^"]*(Incorrect|Invalid) username or password[^"]*".*client_ip=<ADDR>
|
|
|
|
journalmatch = _SYSTEMD_UNIT=miniflux.service
|
|
|
|
'';
|
|
|
|
};
|
2021-02-15 18:45:04 +01:00
|
|
|
};
|
|
|
|
}
|