1 { pkgs, 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
31 #adminCredentialsFile = "/run/credentials/miniflux.service/credentials";
32 adminCredentialsFile = "/dev/null";
34 systemd.services.miniflux = {
35 partOf = [ "postgresql.service" ];
36 # For the socket-activation
37 wantedBy = lib.mkForce [ ];
39 RefuseManualStart = true;
43 ExecStart = lib.mkForce (pkgs.writeShellScript "miniflux" ''
44 . /run/credentials/miniflux.service/credentials
47 exec ${pkgs.miniflux}/bin/miniflux
49 LoadCredentialEncrypted = [
50 "credentials:${miniflux/credentials.cred}"
53 #User = users."miniflux".name;
54 Group = groups."postgres".name;
57 "/run/systemd/journal/socket"
59 "/etc/pki/tls/certs/ca-bundle.crt"
60 "/etc/static/pki/tls/certs/ca-bundle.crt"
61 "/etc/ssl/certs/ca-certificates.crt"
62 "/etc/static/ssl/certs/ca-certificates.crt"
65 RuntimeDirectory = lib.mkForce [
67 "confinement/miniflux"
70 #DynamicUser = lib.mkForce false;
71 UMask = lib.mkForce "0022";
73 NoNewPrivileges = true;
76 #ProtectSystem = true;
81 binSh = "${pkgs.bash}/bin/bash";
88 services.postgresql.identMap = ''
89 # MAPNAME SYSTEM-USERNAME PG-USERNAME
90 user ${users.miniflux.name} ${users.miniflux.name}
92 users.users."miniflux" = {
94 group = groups."postgres".name;
96 services.nginx.virtualHosts."${srv}.${domain}" = {
100 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
101 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
104 proxyPass = "http://unix:/run/miniflux.sock:/";
107 systemd.services.nginx.serviceConfig.LogsDirectory =
108 lib.mkForce [ "nginx/${domain}/${srv}" ];