1 { lib, config, inputs, hostName, ... }:
3 inherit (config.networking) domain;
4 inherit (config.services) nginx postgresql;
5 inherit (config.users) users groups;
9 systemd.sockets.miniflux = {
10 listenStreams = [ "/run/miniflux.sock" ];
11 wantedBy = [ "sockets.target" ];
12 socketConfig.SocketMode = "600";
13 socketConfig.SocketUser = nginx.user;
18 BASE_URL = "https://${srv}.${domain}"; # Base URL to generate HTML links and base path for cookies.
19 BATCH_SIZE = "3"; # Number of feeds to send to the queue for each interval.
20 CLEANUP_ARCHIVE_UNREAD_DAYS = "60";
21 CLEANUP_ARCHIVE_READ_DAYS = "30";
24 #METRICS_COLLECTOR = "1";
25 POLLING_FREQUENCY = "180";
26 POLLING_SCHEDULER = "entry_frequency";
27 SCHEDULER_ENTRY_FREQUENCY_MAX_INTERVAL = "10080"; # 7*24*60 = 7d
29 WORKER_POOL_SIZE = "2";
31 adminCredentialsFile = "/run/credentials/miniflux.service/credentials";
33 systemd.services.miniflux = {
34 partOf = [ "postgresql.service" ];
35 # For the socket-activation
36 wantedBy = lib.mkForce [ ];
38 RefuseManualStart = true;
41 LoadCredentialEncrypted = [
42 "credentials:${inputs.self}/hosts/${hostName}/miniflux/credentials.cred"
45 User = users."miniflux".name;
46 Group = groups."postgres".name;
49 "/run/systemd/journal/socket"
51 "/etc/pki/tls/certs/ca-bundle.crt"
55 DynamicUser = lib.mkForce false;
56 UMask = lib.mkForce "0022";
58 NoNewPrivileges = true;
61 #ProtectSystem = true;
69 services.postgresql.identMap = ''
70 # MAPNAME SYSTEM-USERNAME PG-USERNAME
71 user ${users.miniflux.name} ${users.miniflux.name}
73 users.users."miniflux" = {
75 group = groups."postgres".name;
77 services.nginx.virtualHosts."${srv}.${domain}" = {
81 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
82 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
85 proxyPass = "http://unix:/run/miniflux.sock:/";
88 systemd.services.nginx.serviceConfig.LogsDirectory =
89 lib.mkForce [ "nginx/${domain}/${srv}" ];