84 current 2025-10-08 11:13:37 25.05.20251001.5b5be50 6.12.49 *
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# flake for blakes nixos config
|
# flake for blakes nixos config
|
||||||
# define new devices in outputs
|
# 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";
|
description = "blakes nix config";
|
||||||
inputs = {
|
inputs = {
|
||||||
|
|||||||
@@ -1,69 +1,69 @@
|
|||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.modules.services.<service_name>;
|
cfg = config.modules.services.qbittorrent;
|
||||||
ids = <gid_and_uid_number>;
|
ids = 2003;
|
||||||
default_port = <port_number>;
|
default_port = 8080;
|
||||||
data_dir = "/var/lib/<service_name>";
|
data_dir = "/var/lib/qBittorrent";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.modules.services.<service_name> = {
|
options.modules.services.qbittorrent = {
|
||||||
enable = lib.mkEnableOption "enables <service_name>";
|
enable = lib.mkEnableOption "enables qbittorrent";
|
||||||
|
|
||||||
# set port options
|
# set port options
|
||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
type = lib.types.int;
|
type = lib.types.int;
|
||||||
default = <port>;
|
default = 7103;
|
||||||
description = "set port for <service_name> (default: ${toString default_port}";
|
description = "set port for qbittorrent (default: ${toString default_port}";
|
||||||
};
|
};
|
||||||
|
|
||||||
backup = lib.mkOption {
|
backup = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "enable backups for <service_name>";
|
description = "enable backups for qbittorrent";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
# declare <service_name> group
|
# declare qbittorrent group
|
||||||
users.groups.<service_name> = { gid = ids; };
|
users.groups.qbittorrent = { gid = ids; };
|
||||||
|
|
||||||
# declare <service_name> user
|
# declare qbittorrent user
|
||||||
users.users.<service_name> = {
|
users.users.qbittorrent = {
|
||||||
description = "<service_name> server user";
|
description = "qbittorrent server user";
|
||||||
uid = ids;
|
uid = ids;
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
home = "/var/lib/<service_name>";
|
home = data_dir;
|
||||||
createHome = true;
|
createHome = true;
|
||||||
group = "<service_name>";
|
group = "qbittorrent";
|
||||||
extraGroups = [ "media" ];
|
extraGroups = [ "media" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# enable the <service_name> service
|
# enable the qbittorrent service
|
||||||
services.<service_name> = {
|
services.qbittorrent = {
|
||||||
enable = true;
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
user = "<service_name>";
|
user = "qbittorrent";
|
||||||
group = "<service_name>";
|
group = "qbittorrent";
|
||||||
dataDir = data_dir;
|
profileDir = data_dir;
|
||||||
settings = {
|
webuiPort = cfg.port;
|
||||||
server.port = cfg.port;
|
# torrentingPort = cfg.port;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# override umask to make permissions work out
|
# override umask to make permissions work out
|
||||||
systemd.services.<service_name>.serviceConfig = {
|
systemd.services.qbittorrent.serviceConfig = {
|
||||||
UMask = lib.mkForce "0007";
|
UMask = lib.mkForce "0007";
|
||||||
# User = "<service_name>";
|
# User = "qbittorrent";
|
||||||
# Group = "<service_name>";
|
# Group = "qbittorrent";
|
||||||
};
|
};
|
||||||
|
|
||||||
# # open firewall
|
# # open firewall
|
||||||
# networking.firewall.allowedTCPPorts = [ cfg.port ];
|
# networking.firewall.allowedTCPPorts = [ cfg.port ];
|
||||||
|
|
||||||
# internal reverse proxy entry
|
# internal reverse proxy entry
|
||||||
services.nginx.virtualHosts."<service_name>.snowbelle.lan" = {
|
services.nginx.virtualHosts.".snowbelle.lan" = {
|
||||||
enableACME = false;
|
enableACME = false;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
sslCertificate = config.sops.secrets."ssl_blakedheld_crt".path;
|
sslCertificate = config.sops.secrets."ssl_blakedheld_crt".path;
|
||||||
@@ -72,23 +72,6 @@ in
|
|||||||
proxyPass = "http://127.0.0.1:${toString cfg.port}";
|
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
|
# add to backups
|
||||||
modules.system.backups.paths = lib.mkIf cfg.backup [ data_dir ];
|
modules.system.backups.paths = lib.mkIf cfg.backup [ data_dir ];
|
||||||
|
|||||||
Reference in New Issue
Block a user