aboutsummaryrefslogtreecommitdiff
path: root/nixos/hosts/ev
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-09-18 08:52:11 +0200
committerMartin Fischer <martin@push-f.com>2025-09-18 11:30:46 +0200
commit6f8f7239dc276479d691dcd0ffb5124bd62032ad (patch)
treefcf962ace86b2ff86cbba58166154f53c2cca8a7 /nixos/hosts/ev
parente3c0b6d6091bec87edf709c9d444c825045c8d3d (diff)
feat(ev): add minifluxHEADmaster
I already had a miniflux instance a couple years ago but accidentally dropped the database.
Diffstat (limited to 'nixos/hosts/ev')
-rw-r--r--nixos/hosts/ev/default.nix5
-rw-r--r--nixos/hosts/ev/exporters.nix42
-rw-r--r--nixos/hosts/ev/miniflux.nix27
-rw-r--r--nixos/hosts/ev/ports.nix3
4 files changed, 77 insertions, 0 deletions
diff --git a/nixos/hosts/ev/default.nix b/nixos/hosts/ev/default.nix
index 74518f0..fbda40f 100644
--- a/nixos/hosts/ev/default.nix
+++ b/nixos/hosts/ev/default.nix
@@ -13,11 +13,14 @@ in
./hardware-configuration.nix
<top/profiles/server>
<top/shared/monitoring.nix>
+ <top/shared/postgresql.nix>
<top/shared/tailscale.nix>
<top/shared/basics-physical.nix>
<top/shared/vpn.nix>
+ ./exporters.nix
./home-automation.nix
./kodi.nix
+ ./miniflux.nix
./torrent.nix
./hosehawk.nix
];
@@ -49,7 +52,9 @@ in
monitoring.lokiPort = ports.grafanaLoki;
monitoring.prometheusPort = ports.prometheus;
monitoring.prometheusNodeExporterPort = ports.prometheusNodeExporter;
+ exporters.sqlExporterPort = ports.prometheusSqlExporter;
hosehawk.port = ports.hosehawk;
+ miniflux.port = ports.miniflux;
home-automation.zigbeeSerialPort = "/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_e2fed465c59ded11962fd7a5a7669f5d-if00-port0";
diff --git a/nixos/hosts/ev/exporters.nix b/nixos/hosts/ev/exporters.nix
new file mode 100644
index 0000000..1c03c35
--- /dev/null
+++ b/nixos/hosts/ev/exporters.nix
@@ -0,0 +1,42 @@
+{ config, lib, pkgs, ... }:
+
+let
+ helpers = import <top/shared/postgres-collectors.nix> { inherit config lib pkgs; };
+ cfg = config.exporters;
+in
+{
+ options.exporters = {
+ sqlExporterPort = lib.mkOption {
+ type = lib.types.int;
+ };
+ };
+
+ imports = [
+ <top/shared/prometheus-sql-exporter/service.nix>
+ ];
+
+ config = {
+ services.prometheus-sql-exporter = {
+ enable = true;
+ port = cfg.sqlExporterPort;
+ config = {
+ target = {
+ # This URL should be postgresql:///postgres?host=/run/postgresql
+ # but sql_exporter uses xo/dburl which isn't spec-compliant: https://github.com/xo/dburl/issues/46
+ data_source_name = "postgresql:/run/postgresql:/postgres";
+ collectors = helpers.collectorNames;
+ };
+ collectors = helpers.collectors;
+ };
+ };
+
+ monitoring.prometheusScrapeConfigs = [
+ {
+ job_name = "sql";
+ static_configs = [{
+ targets = [ "localhost:${toString cfg.sqlExporterPort}" ];
+ }];
+ }
+ ];
+ };
+}
diff --git a/nixos/hosts/ev/miniflux.nix b/nixos/hosts/ev/miniflux.nix
new file mode 100644
index 0000000..5bf1ccd
--- /dev/null
+++ b/nixos/hosts/ev/miniflux.nix
@@ -0,0 +1,27 @@
+{ config, lib, pkgs, ... }:
+
+let
+ cfg = config.miniflux;
+in
+{
+ options.miniflux = {
+ port = lib.mkOption {
+ type = lib.types.int;
+ };
+ };
+
+ config = {
+ age.secrets.miniflux-admin.file = <top/secrets/miniflux-admin.age>;
+
+ services.miniflux = {
+ enable = true;
+ config = {
+ LISTEN_ADDR = "0.0.0.0:${toString cfg.port}";
+ DATABASE_URL = "user=miniflux host=/run/postgresql dbname=miniflux";
+ };
+ # miniflux does not support disabling its authentication. https://github.com/miniflux/v2/issues/408
+ adminCredentialsFile = config.age.secrets.miniflux-admin.path;
+ createDatabaseLocally = false;
+ };
+ };
+}
diff --git a/nixos/hosts/ev/ports.nix b/nixos/hosts/ev/ports.nix
index cd41d1b..502e190 100644
--- a/nixos/hosts/ev/ports.nix
+++ b/nixos/hosts/ev/ports.nix
@@ -2,8 +2,10 @@ rec {
grafanaAlloy = 3001;
grafanaLoki = 3030;
hosehawk = 4000;
+ miniflux = 4001;
prometheus = 9090;
prometheusNodeExporter = 9002;
+ prometheusSqlExporter = 9003;
qbittorrent = 7777;
zigbee2mqtt = 8080;
@@ -11,6 +13,7 @@ rec {
inherit
grafanaAlloy
hosehawk
+ miniflux
prometheus
qbittorrent
zigbee2mqtt