summary refs log tree commit diff
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/freshrss.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/services/freshrss.nix b/services/freshrss.nix
new file mode 100644
index 0000000..bdb087f
--- /dev/null
+++ b/services/freshrss.nix
@@ -0,0 +1,44 @@
+{ me, pkgs, auxiliaryPkgs, ... }:
+
+let
+  inherit (pkgs) php lighttpd freshrss dockerTools;
+  inherit (auxiliaryPkgs) common;
+
+  freshrssLocalPort = 1819;
+  freshrssDir = "/srv/freshrss";
+
+  freshrssImage = dockerTools.streamLayeredImage {
+    name = "freshrss";
+    tag = freshrss.version;
+    fromImage = common.alpine.base;
+
+    contents = [ lighttpd freshrss php ];
+
+    extraCommands = ''
+      mkdir -p ./opt ./var/log/lighttpd
+      touch ./var/log/lighttpd/access.log ./var/log/lighttpd/error.log
+      ln -s ${freshrss} ./opt/freshrss
+    '';
+  };
+
+in
+{
+  # TODO: ..it won't work without cron :3
+  foundation.services.freshrss = {
+    image = freshrssImage;
+    ports = [
+      (common.tailnetPort me [ freshrssLocalPort 80 ])
+    ];
+
+    volumes = [
+      [ "${freshrssDir}/lighttpd.conf" "/etc/lighttpd/freshrss.conf" ]
+      [ "${freshrssDir}/data" "/opt/freshrss/data" ]
+    ];
+
+    entrypoint = "${lighttpd}/bin/lighttpd";
+    cmd = [
+      "-D" # run in foreground
+      "-f" "/etc/lighttpd/freshrss.conf"
+    ];
+  };
+}