From 2199c1b10c48f684e88012311d156931c91562d1 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 15 Feb 2021 17:45:04 +0000 Subject: [PATCH] services: add Miniflux --- services/default.nix | 1 + services/miniflux.nix | 67 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 services/miniflux.nix diff --git a/services/default.nix b/services/default.nix index a37855a..449c1f7 100644 --- a/services/default.nix +++ b/services/default.nix @@ -10,6 +10,7 @@ ./jellyfin.nix ./matrix.nix ./media.nix + ./miniflux.nix ./nextcloud.nix ./nginx.nix ./pirate.nix diff --git a/services/miniflux.nix b/services/miniflux.nix new file mode 100644 index 0000000..67b8967 --- /dev/null +++ b/services/miniflux.nix @@ -0,0 +1,67 @@ +# A minimalist, opinionated feed reader +{ config, lib, ... }: +let + cfg = config.my.services.miniflux; + + domain = config.networking.domain; + minifluxDomain = "reader.${config.networking.domain}"; +in +{ + options.my.services.miniflux = with lib; { + enable = mkEnableOption "Miniflux feed reader"; + + username = mkOption { + type = types.str; + default = "Ambroisie"; + example = "username"; + description = "Name of the transmission RPC user"; + }; + + password = mkOption { + type = types.str; + example = "password"; + description = "Password of the transmission RPC user"; + }; + + privatePort = mkOption { + 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 + BASE_URL = "https://${minifluxDomain}"; + LISTEN_ADDR = "localhost:${toString cfg.privatePort}"; + # I want fast updates + POLLING_FREQUENCY = "30"; + BATCH_SIZE = "50"; + # I am a hoarder + CLEANUP_ARCHIVE_UNREAD_DAYS = "-1"; + CLEANUP_ARCHIVE_READ_DAYS = "-1"; + }; + }; + + # Proxy to Jellyfin + services.nginx.virtualHosts."${minifluxDomain}" = { + forceSSL = true; + useACMEHost = "${domain}"; + + locations."/".proxyPass = "http://localhost:${toString cfg.privatePort}/"; + }; + }; +}