{ config, lib, pkgs, ... }: with lib; let cfg = config.features.homelab.freshrss; port = 4003; in { options.features.homelab.freshrss.enable = mkEnableOption "Enable freshrss"; config = mkIf cfg.enable { # Auto-generated using compose2nix v0.3.2-pre. virtualisation = { docker = { enable = true; autoPrune.enable = true; }; oci-containers.backend = "docker"; }; virtualisation.oci-containers.containers."freshrss" = { image = "lscr.io/linuxserver/freshrss:latest"; environment = { "PGID" = "1000"; "PUID" = "1000"; "TZ" = "Etc/UTC"; }; volumes = [ "/home/opdavies/Code/dotfiles/freshrss-config:/config:rw" ]; ports = [ "${toString port}:80/tcp" ]; log-driver = "journald"; extraOptions = [ "--network-alias=freshrss" "--network=freshrss_default" ]; }; systemd.services."docker-freshrss" = { serviceConfig = { Restart = lib.mkOverride 90 "always"; RestartMaxDelaySec = lib.mkOverride 90 "1m"; RestartSec = lib.mkOverride 90 "100ms"; RestartSteps = lib.mkOverride 90 9; }; after = [ "docker-network-freshrss_default.service" ]; requires = [ "docker-network-freshrss_default.service" ]; partOf = [ "docker-compose-freshrss-root.target" ]; wantedBy = [ "docker-compose-freshrss-root.target" ]; }; systemd.services."docker-network-freshrss_default" = { path = [ pkgs.docker ]; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; ExecStop = "docker network rm -f freshrss_default"; }; script = '' docker network inspect freshrss_default || docker network create freshrss_default ''; partOf = [ "docker-compose-freshrss-root.target" ]; wantedBy = [ "docker-compose-freshrss-root.target" ]; }; systemd.targets."docker-compose-freshrss-root" = { unitConfig = { Description = "Root target generated by compose2nix."; }; wantedBy = [ "multi-user.target" ]; }; services.caddy.virtualHosts."freshrss.opdavies.uk" = { useACMEHost = "opdavies.uk"; extraConfig = "reverse_proxy localhost:${toString port}"; }; }; }