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";
|
|
|
|
|
|
|
|
username = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "Ambroisie";
|
|
|
|
example = "username";
|
2021-02-27 11:09:40 +01:00
|
|
|
description = "Name of the admin user";
|
2021-02-15 18:45:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
password = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "password";
|
2021-02-27 11:09:40 +01:00
|
|
|
description = "Password of the admin user";
|
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;
|
|
|
|
|
|
|
|
adminCredentialsFile =
|
|
|
|
# Insecure, I don't care.
|
|
|
|
builtins.toFile "credentials.env" ''
|
|
|
|
ADMIN_USERNAME=${cfg.username}
|
|
|
|
ADMIN_PASSWORD=${cfg.password}
|
|
|
|
'';
|
|
|
|
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-08-24 23:05:10 +02:00
|
|
|
my.services.nginx.virtualHosts = [
|
|
|
|
{
|
|
|
|
subdomain = "reader";
|
|
|
|
inherit (cfg) port;
|
|
|
|
}
|
|
|
|
];
|
2021-02-15 18:45:04 +01:00
|
|
|
};
|
|
|
|
}
|