From 35d6d350cce750df78113c25c0a2cb1b72bfa659 Mon Sep 17 00:00:00 2001 From: Dmitriy Kholkin Date: Sat, 28 Dec 2024 11:54:49 +0300 Subject: [PATCH] mount nfs share into qbittorrent container --- profiles/servers/media-stack/qbittorrent.nix | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/profiles/servers/media-stack/qbittorrent.nix b/profiles/servers/media-stack/qbittorrent.nix index f96c9e7..0a10c4c 100644 --- a/profiles/servers/media-stack/qbittorrent.nix +++ b/profiles/servers/media-stack/qbittorrent.nix @@ -1,6 +1,9 @@ -{ ... }: +{ config, pkgs, ... }: let + backend = "podman"; nas-path = "/media/nas/media-stack"; + volume = "local-nfs"; + nfs-share = "10.10.10.11:/"; in { virtualisation.oci-containers.containers.qbittorrent = { autoStart = true; @@ -11,11 +14,27 @@ in { UMASK = "002"; TZ = "Europe/Moscow"; TORRENTING_PORT = "7000"; + DOCKER_MODS = "ghcr.io/gabe565/linuxserver-mod-vuetorrent"; }; extraOptions = [ "--pod=media-stack" ]; volumes = [ "${nas-path}/configs/qbittorrent:/config" "${nas-path}:/data" + "${volume}:/nfs" ]; }; + + systemd.services."podman-create-volume-${volume}" = let + start = pkgs.writeShellScript "create-volume-${volume}" '' + podman volume exists ${volume} || podman volume create --opt type=nfs4 --opt o=rw --opt device=${nfs-share} ${volume} + ''; + in rec { + path = [ config.virtualisation.podman.package ]; + before = [ "${backend}-qbittorrent.service" ]; + requiredBy = before; + serviceConfig = { + Type = "oneshot"; + ExecStart = start; + }; + }; } \ No newline at end of file