NixOS/modules/servers/metube.nix

32 lines
841 B
Nix

{
lib,
config,
proxyReverse,
setup,
...
}:
let
cfg = config.my.servers.metube;
in
{
options.my.servers.metube = setup.mkOptions "metube" "bajameesta" 8881;
config = {
networking.firewall.allowedTCPPorts = lib.mkIf (!cfg.isLocal) [ cfg.port ];
virtualisation.oci-containers.containers.metube = lib.mkIf cfg.enable {
image = "ghcr.io/alexta69/metube:latest";
ports = [ "${toString cfg.port}:8081" ];
volumes = [
"${config.my.containerData}/metube:/downloads"
"/home/jawz/.local/share/cookies.txt:/cookies.txt"
];
environment = {
TZ = config.my.timeZone;
YTDL_OPTIONS = ''{"cookiefile":"/cookies.txt"}'';
};
};
services.nginx.virtualHosts."${cfg.host}" = lib.mkIf cfg.enableProxy (
proxyReverse cfg.hostName cfg.port // { }
);
};
}