podman: added qbittorrent container

This commit is contained in:
Tigor Hutasuhut 2024-06-18 20:24:28 +07:00
parent 6fdc75933d
commit 6c610ffe00
4 changed files with 56 additions and 0 deletions

View file

@ -8,5 +8,6 @@
ytptube.enable = lib.mkEnableOption "metube podman"; ytptube.enable = lib.mkEnableOption "metube podman";
redmage.enable = lib.mkEnableOption "redmage podman"; redmage.enable = lib.mkEnableOption "redmage podman";
redmage-demo.enable = lib.mkEnableOption "redmage-demo podman"; redmage-demo.enable = lib.mkEnableOption "redmage-demo podman";
qbittorrent.enable = lib.mkEnableOption "qbittorrent podman";
}; };
} }

View file

@ -30,6 +30,7 @@
ytptube.enable = true; ytptube.enable = true;
redmage.enable = true; redmage.enable = true;
redmage-demo.enable = true; redmage-demo.enable = true;
qbittorrent.enable = true;
}; };
docker = { docker = {

View file

@ -44,6 +44,7 @@ in
./pihole.nix ./pihole.nix
./redmage-demo.nix ./redmage-demo.nix
./redmage.nix ./redmage.nix
./qbittorrent.nix
./suwayomi.nix ./suwayomi.nix
./ytptube.nix ./ytptube.nix
]; ];

View file

@ -0,0 +1,53 @@
{ config, lib, ... }:
let
name = "qbittorrent";
domain = "${name}.tigor.web.id";
podman = config.profile.podman;
qbittorrent = podman.qbittorrent;
inherit (lib) mkIf;
ip = "10.88.0.7";
image = "lscr.io/linuxserver/qbittorrent:latest";
volume = "/nas/torrents";
user = config.profile.user;
uid = toString user.uid;
gid = toString user.gid;
in
{
config = mkIf (podman.enable && qbittorrent.enable) {
services.caddy.virtualHosts.${domain}.extraConfig = ''
reverse_proxy ${ip}:8080
'';
system.activationScripts."podman-${name}" = ''
mkdir -p ${volume}/{config,downloads,progress,auto}
chown ${uid}:${gid} ${volume} ${volume}/{config,downloads,progress,auto}
'';
virtualisation.oci-containers.containers.${name} = {
inherit image;
autoStart = true;
environment = {
PUID = uid;
PGID = gid;
TZ = "Asia/Jakarta";
WEBUI_PORT = "8080";
TORRENTING_PORT = "6881";
};
volumes = [
"${volume}/config:/config"
"${volume}/downloads:/downloads"
"${volume}/progress:/progress"
"${volume}/auto:/auto"
];
ports = [
"6881:6881"
"6881:6881/udp"
];
extraOptions = [
"--ip=${ip}"
"--network=podman"
];
};
};
}