summary refs log tree commit diff
path: root/services/freshrss.nix
blob: bdb087f73602556d655b3f6243aaaa6e884bdb3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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"
    ];
  };
}