{ pkgs, lib, ... }:
let
  settings = import ./settings.nix;
in
{
  imports = [
    ./apps/actual
    ./apps/arrs
    ./apps/crowdsec
    ./apps/excalidraw
    ./apps/gitea
    ./apps/immich
    ./apps/jellyfin
    ./apps/jellyseerr
    ./apps/lubelogger
    ./apps/nextcloud
    ./apps/ollama
    ./apps/orca
    ./apps/paperless
    ./apps/traefik
    ./apps/wyoming
    ../../modules
  ];

  nas-apps = {
    actual = {
      enable = true;
      port = 3333;
      localAddress = "10.0.3.18";
      dataDir = "/media/nas/ssd/nix-app-data/actual";
      reverseProxy = {
        enable = true;
        host = "actual.mjallen.dev";
        middlewares = [ "crowdsec" "whitelist-geoblock" ];
      };
    };

    arrs = {
      enable = true;
      localAddress = "10.0.1.51";
      downloadsDir = "/media/nas/ssd/ssd_app_data/downloads";
      incompleteDownloadsDir = "/media/nas/ssd/ssd_app_data/downloads-incomplete";
      moviesDir = "/media/nas/main/movies";
      tvDir = "/media/nas/main/tv";
      isosDir = "/media/nas/main/isos";
      radarr = {
        enable = true;
        port = 7878;
        dataDir = "/media/nas/ssd/nix-app-data/radarr";
      };
      sonarr = {
        enable = true;
        port = 8989;
        dataDir = "/media/nas/ssd/nix-app-data/sonarr";
      };
      sabnzbd = {
        enable = true;
        port = 8280;
        dataDir = "/media/nas/ssd/nix-app-data/sabnzbd";
      };
      deluge = {
        enable = true;
        port = 8112;
      };
      jackett = {
        enable = true;
        port = 9117;
        dataDir = "/media/nas/ssd/nix-app-data/jackett";
      };
    };

    crowdsec = {
      enable = true;
      port = 9898;
      apiAddress = settings.hostAddress;
      apiKey = "1daH89qmJ41r2Lpd9hvDw4sxtOAtBzaj3aKFOFqE";
      dataDir = "/media/nas/ssd/nix-app-data/crowdsec";
    };

    gitea = {
      enable = true;
      httpPort = 3000;
      sshPort = 2222;
      localAddress = "10.0.4.18";
      dataDir = "/media/nas/ssd/nix-app-data/gitea";
      reverseProxy = {
        enable = true;
        host = "gitea.mjallen.dev";
        middlewares = [ "crowdsec" "whitelist-geoblock" ];
      };
    };

    free-games-claimer.enable = true;

    manyfold.enable = true;

    orca-slicer = {
      enable = true;
      httpPort = "3100";
      httpsPort = "3101";
    };

    tdarr.enable = true;
  };
}
