modules: services: use new nginx wrapper
All checks were successful
continuous-integration/drone/push Build is passing

And when not possible, document why.

Note for the future: there is some repetition in some modules to
configure the correct value of the subdomain, which I happen to know
will line up correctly thanks to the nginx wrapper. A good way to
refactor this in the future would involve avoiding this repetition,
allowing use to query the correct domain in some way...
This commit is contained in:
Bruno BELANYI 2021-08-24 23:05:10 +02:00
parent 81e12969eb
commit 7032ddef37
19 changed files with 187 additions and 254 deletions

View file

@ -2,9 +2,6 @@
{ config, lib, ... }:
let
cfg = config.my.services.miniflux;
domain = config.networking.domain;
minifluxDomain = "reader.${config.networking.domain}";
in
{
options.my.services.miniflux = with lib; {
@ -23,7 +20,7 @@ in
description = "Password of the admin user";
};
privatePort = mkOption {
port = mkOption {
type = types.port;
default = 9876;
example = 8080;
@ -45,8 +42,8 @@ in
config = {
# Virtual hosts settings
BASE_URL = "https://${minifluxDomain}";
LISTEN_ADDR = "localhost:${toString cfg.privatePort}";
BASE_URL = "https://reader.${config.networking.domain}";
LISTEN_ADDR = "localhost:${toString cfg.port}";
# I want fast updates
POLLING_FREQUENCY = "30";
BATCH_SIZE = "50";
@ -56,12 +53,11 @@ in
};
};
# Proxy to Jellyfin
services.nginx.virtualHosts."${minifluxDomain}" = {
forceSSL = true;
useACMEHost = domain;
locations."/".proxyPass = "http://127.0.0.1:${toString cfg.privatePort}/";
};
my.services.nginx.virtualHosts = [
{
subdomain = "reader";
inherit (cfg) port;
}
];
};
}