nix-config/modules/services/miniflux.nix

54 lines
1.2 KiB
Nix
Raw Normal View History

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";
credentialsFiles = mkOption {
2021-02-15 18:45:04 +01:00
type = types.str;
example = "/var/lib/miniflux/creds.env";
description = ''
Credential file as an 'EnvironmentFile' (see `systemd.exec(5)`)
'';
2021-02-15 18:45:04 +01: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;
adminCredentialsFile = cfg.credentialsFiles;
2021-02-15 18:45:04 +01:00
config = {
# Virtual hosts settings
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";
};
};
my.services.nginx.virtualHosts = [
{
subdomain = "reader";
inherit (cfg) port;
}
];
2021-02-15 18:45:04 +01:00
};
}