84 current 2025-10-08 11:13:37 25.05.20251001.5b5be50 6.12.49 *

This commit is contained in:
2025-10-08 12:02:25 -05:00
parent 46da53653c
commit 2cd38396d5
2 changed files with 29 additions and 46 deletions

View File

@@ -1,6 +1,6 @@
# flake for blakes nixos config
# define new devices in outputs
# generation: 83 current 2025-10-08 11:10:08 25.05.20251001.5b5be50 6.12.49 *
# generation: 84 current 2025-10-08 11:13:37 25.05.20251001.5b5be50 6.12.49 *
{
description = "blakes nix config";
inputs = {

View File

@@ -1,69 +1,69 @@
{ pkgs, config, lib, ... }:
let
cfg = config.modules.services.<service_name>;
ids = <gid_and_uid_number>;
default_port = <port_number>;
data_dir = "/var/lib/<service_name>";
cfg = config.modules.services.qbittorrent;
ids = 2003;
default_port = 8080;
data_dir = "/var/lib/qBittorrent";
in
{
options.modules.services.<service_name> = {
enable = lib.mkEnableOption "enables <service_name>";
options.modules.services.qbittorrent = {
enable = lib.mkEnableOption "enables qbittorrent";
# set port options
port = lib.mkOption {
type = lib.types.int;
default = <port>;
description = "set port for <service_name> (default: ${toString default_port}";
default = 7103;
description = "set port for qbittorrent (default: ${toString default_port}";
};
backup = lib.mkOption {
type = lib.types.bool;
default = true;
description = "enable backups for <service_name>";
description = "enable backups for qbittorrent";
};
};
config = lib.mkIf cfg.enable {
# declare <service_name> group
users.groups.<service_name> = { gid = ids; };
# declare qbittorrent group
users.groups.qbittorrent = { gid = ids; };
# declare <service_name> user
users.users.<service_name> = {
description = "<service_name> server user";
# declare qbittorrent user
users.users.qbittorrent = {
description = "qbittorrent server user";
uid = ids;
isSystemUser = true;
home = "/var/lib/<service_name>";
home = data_dir;
createHome = true;
group = "<service_name>";
group = "qbittorrent";
extraGroups = [ "media" ];
};
# enable the <service_name> service
services.<service_name> = {
# enable the qbittorrent service
services.qbittorrent = {
enable = true;
openFirewall = true;
user = "<service_name>";
group = "<service_name>";
dataDir = data_dir;
settings = {
server.port = cfg.port;
};
user = "qbittorrent";
group = "qbittorrent";
profileDir = data_dir;
webuiPort = cfg.port;
# torrentingPort = cfg.port;
};
# override umask to make permissions work out
systemd.services.<service_name>.serviceConfig = {
systemd.services.qbittorrent.serviceConfig = {
UMask = lib.mkForce "0007";
# User = "<service_name>";
# Group = "<service_name>";
# User = "qbittorrent";
# Group = "qbittorrent";
};
# # open firewall
# networking.firewall.allowedTCPPorts = [ cfg.port ];
# internal reverse proxy entry
services.nginx.virtualHosts."<service_name>.snowbelle.lan" = {
services.nginx.virtualHosts.".snowbelle.lan" = {
enableACME = false;
forceSSL = true;
sslCertificate = config.sops.secrets."ssl_blakedheld_crt".path;
@@ -72,23 +72,6 @@ in
proxyPass = "http://127.0.0.1:${toString cfg.port}";
};
};
# # external reverse proxy entry
# services.nginx.virtualHosts."<service_name>.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 = {
"<service_name>_" = {
owner = "<service_name>";
group = "<service_name>";
};
};
# add to backups
modules.system.backups.paths = lib.mkIf cfg.backup [ data_dir ];