From c84eef3218fcfe9c621727f4e136489242eb3a6e Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Tue, 11 Apr 2023 10:42:00 +0200 Subject: [PATCH] set up tdarr --- nixos/components/network/tinc/private.nix | 1 + nixos/machines/pepe/configuration.nix | 1 + nixos/machines/pepe/home-display.nix | 8 ++-- nixos/machines/pepe/tdarr.nix | 54 +++++++++++++++++++++++ 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 nixos/machines/pepe/tdarr.nix diff --git a/nixos/components/network/tinc/private.nix b/nixos/components/network/tinc/private.nix index e925ed7..fe8039c 100644 --- a/nixos/components/network/tinc/private.nix +++ b/nixos/components/network/tinc/private.nix @@ -27,6 +27,7 @@ let "grafana.pepe" = hosts.pepe; "prometheus.pepe" = hosts.pepe; "tts.pepe" = hosts.pepe; + "tdarr.pepe" = hosts.pepe; }; network = "private"; in diff --git a/nixos/machines/pepe/configuration.nix b/nixos/machines/pepe/configuration.nix index c9ec45d..b973c90 100644 --- a/nixos/machines/pepe/configuration.nix +++ b/nixos/machines/pepe/configuration.nix @@ -32,6 +32,7 @@ ./telegraf.nix ./home-display.nix + ./tdarr.nix ]; diff --git a/nixos/machines/pepe/home-display.nix b/nixos/machines/pepe/home-display.nix index b33f32f..9985686 100644 --- a/nixos/machines/pepe/home-display.nix +++ b/nixos/machines/pepe/home-display.nix @@ -15,10 +15,10 @@ mustache = "${pkgs.mustache-go}/bin/mustache"; jq = "${pkgs.jq}/bin/jq"; index_html_template = refreshSeconds: pkgs.writeText "index_html.template" '' - - - {{ date }} - + + + {{ date }} + ''; in diff --git a/nixos/machines/pepe/tdarr.nix b/nixos/machines/pepe/tdarr.nix new file mode 100644 index 0000000..1660d7a --- /dev/null +++ b/nixos/machines/pepe/tdarr.nix @@ -0,0 +1,54 @@ +{ config, lib, pkgs, ... }: +{ + + users.users.tdarr = { + isNormalUser = true; + group = "syncthing"; + }; + + # https://docs.tdarr.io/docs/installation/docker/run-compose + virtualisation.oci-containers = { + backend = "podman"; + containers.tdarr = { + volumes = [ + "/srv/tdarr/server:/app/server" + "/srv/tdarr/configs:/app/configs" + "/srv/tdarr/logs:/app/logs" + "/srv/tdarr/transcode_cache:/temp" + "/media/syncthing/media:/media" + ]; + environment = { + serverIP = "0.0.0.0"; + serverPort = "8266"; + webUIPort = "8265"; + internalNode = "false"; + inContainer = "true"; + nodeName = "ServerNode"; + TZ = "Europe/London"; + PGID = "237"; + }; + ports = [ + "8265:8265" # WebUI + "8266:8266" # server port + ]; + image = "ghcr.io/haveagitgat/tdarr:latest"; # Warning: if the tag does not change, the image will not be updated + extraOptions = [ "--network=bridge" ]; + }; + }; + + networking.firewall.allowedTCPPorts = [ 8266 ]; + networking.firewall.allowedUDPPorts = [ 8266 ]; + + services.nginx.virtualHosts."tdarr.pepe.private" = { + serverAliases = [ "tdarr.pepe" ]; + extraConfig = '' + allow ${config.tinc.private.subnet}; + deny all; + ''; + locations."/" = { + proxyPass = "http://localhost:8265"; + proxyWebsockets = true; + }; + }; + +}