From 46da53653c87b0b3808765644bd4cb8ddd445734 Mon Sep 17 00:00:00 2001 From: blake Date: Wed, 8 Oct 2025 11:52:55 -0500 Subject: [PATCH] adding qbittorrent --- .../homelab/services/qbittorrent/default.nix | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 modules/homelab/services/qbittorrent/default.nix diff --git a/modules/homelab/services/qbittorrent/default.nix b/modules/homelab/services/qbittorrent/default.nix new file mode 100644 index 0000000..3040285 --- /dev/null +++ b/modules/homelab/services/qbittorrent/default.nix @@ -0,0 +1,96 @@ +{ pkgs, config, lib, ... }: + +let + cfg = config.modules.services.; + ids = ; + default_port = ; + data_dir = "/var/lib/"; +in +{ + options.modules.services. = { + enable = lib.mkEnableOption "enables "; + + # set port options + port = lib.mkOption { + type = lib.types.int; + default = ; + description = "set port for (default: ${toString default_port}"; + }; + + backup = lib.mkOption { + type = lib.types.bool; + default = true; + description = "enable backups for "; + }; + }; + + config = lib.mkIf cfg.enable { + + # declare group + users.groups. = { gid = ids; }; + + # declare user + users.users. = { + description = " server user"; + uid = ids; + isSystemUser = true; + home = "/var/lib/"; + createHome = true; + group = ""; + extraGroups = [ "media" ]; + }; + + # enable the service + services. = { + enable = true; + openFirewall = true; + user = ""; + group = ""; + dataDir = data_dir; + settings = { + server.port = cfg.port; + }; + }; + + # override umask to make permissions work out + systemd.services..serviceConfig = { + UMask = lib.mkForce "0007"; +# User = ""; +# Group = ""; + }; + +# # open firewall +# networking.firewall.allowedTCPPorts = [ cfg.port ]; + + # internal reverse proxy entry + services.nginx.virtualHosts.".snowbelle.lan" = { + enableACME = false; + forceSSL = true; + sslCertificate = config.sops.secrets."ssl_blakedheld_crt".path; + sslCertificateKey = config.sops.secrets."ssl_blakedheld_key".path; + locations."/" = { + proxyPass = "http://127.0.0.1:${toString cfg.port}"; + }; + }; +# # external reverse proxy entry +# services.nginx.virtualHosts.".blakedheld.xyz" = { +# enableACME = false; +# forceSSL = true; +# sslCertificate = config.sops.secrets."ssl_blakedheld_crt".path; +# sslCertificateKey = config.sops.secrets."ssl_blakedheld_key".path; +# locations."/" = { +# proxyPass = "http://127.0.0.1:${toString cfg.port}"; +# }; +# }; + + sops.secrets = { + "_" = { + owner = ""; + group = ""; + }; + }; + + # add to backups + modules.system.backups.paths = lib.mkIf cfg.backup [ data_dir ]; + }; +}