From b368c62b3da3b5eae9fd3a46c12ed05950b93a60 Mon Sep 17 00:00:00 2001 From: FabricSoul Date: Wed, 2 Jul 2025 17:26:52 -0400 Subject: [PATCH] feat: add qbit --- hosts/common/optional/nfs.nix | 2 +- hosts/common/optional/qbit.nix | 35 +++++++++++++++++++++++------- hosts/common/optional/samba.nix | 38 +++++++++++++++++++++++++++++++++ hosts/tatara/default.nix | 2 ++ 4 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 hosts/common/optional/samba.nix diff --git a/hosts/common/optional/nfs.nix b/hosts/common/optional/nfs.nix index 636e3ec..7901b50 100644 --- a/hosts/common/optional/nfs.nix +++ b/hosts/common/optional/nfs.nix @@ -6,7 +6,7 @@ # Define your exports exports = '' - /nas 192.168.2.101(rw,sync,no_root_squash,no_subtree_check) 100.0.0.0/8(rw,sync,no_root_squash,no_subtree_check) + /nas 100.0.0.0/8(rw,sync,no_root_squash,no_subtree_check) ''; # Enable NFSv4 (recommended) diff --git a/hosts/common/optional/qbit.nix b/hosts/common/optional/qbit.nix index 0c1d481..ff2ba2a 100644 --- a/hosts/common/optional/qbit.nix +++ b/hosts/common/optional/qbit.nix @@ -1,11 +1,30 @@ {...}: { - # Enable qBittorrent daemon - services.qbittorrent = { - enable = true; - dataDir = "/var/lib/qbittorrent"; - user = "qbittorrent"; - group = "qbittorrent"; - port = 8080; # WebUI port - openFirewall = true; # Opens the WebUI port in firewall + virtualisation.oci-containers = { + backend = "docker"; # or "podman" + containers = { + qbittorrent = { + image = "lscr.io/linuxserver/qbittorrent:latest"; + autoStart = true; # Equivalent to restart: unless-stopped + + environment = { + PUID = "1000"; + PGID = "1000"; + TZ = "Etc/UTC"; + WEBUI_PORT = "8080"; + TORRENTING_PORT = "6881"; + }; + + volumes = [ + "/path/to/qbittorrent/appdata:/config" + "/nas/downloads:/downloads" # optional + ]; + + ports = [ + "8080:8080" # WebUI + "6881:6881" # Torrenting TCP + "6881:6881/udp" # Torrenting UDP + ]; + }; + }; }; } diff --git a/hosts/common/optional/samba.nix b/hosts/common/optional/samba.nix new file mode 100644 index 0000000..bec6310 --- /dev/null +++ b/hosts/common/optional/samba.nix @@ -0,0 +1,38 @@ +# hosts/common/optional/nfs.nix +{...}: { + services.samba = { + enable = true; + securityType = "user"; + openFirewall = true; + settings = { + global = { + "workgroup" = "WORKGROUP"; + "server string" = "smbnix"; + "netbios name" = "smbnix"; + "security" = "user"; + #"use sendfile" = "yes"; + #"max protocol" = "smb2"; + # note: localhost is the ipv6 localhost ::1 + "hosts allow" = "192.168.2. 127.0.0.1 100. localhost"; + "hosts deny" = "0.0.0.0/0"; + "guest account" = "nobody"; + "map to guest" = "bad user"; + }; + "public" = { + "path" = "/nas"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "yes"; + "create mask" = "0644"; + "directory mask" = "0755"; + "force user" = "root"; + "force group" = "root"; + }; + }; + }; + + services.samba-wsdd = { + enable = true; + openFirewall = true; + }; +} diff --git a/hosts/tatara/default.nix b/hosts/tatara/default.nix index 688de2f..450ac28 100644 --- a/hosts/tatara/default.nix +++ b/hosts/tatara/default.nix @@ -14,7 +14,9 @@ ../common/optional/docker.nix ../common/optional/nfs.nix + ../common/optional/samba.nix ../common/optional/plex.nix + ../common/optional/qbit.nix ]; # Bootloader