From c6506685bab920cc14e217eed1dcf8cc7200153e Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 10 Sep 2024 18:45:36 -0400 Subject: [PATCH] Services: add UI password for Transmission --- flake.lock | 7 +++---- hosts/Hevana/default.nix | 7 ++++++- hosts/Khanda/hardware-configuration.nix | 2 +- modules/services/transmission.nix | 16 ++++++++++++++++ secrets | 2 +- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 3a38060..1a20239 100644 --- a/flake.lock +++ b/flake.lock @@ -378,11 +378,10 @@ "secrets": { "flake": false, "locked": { + "dirtyRev": "9821d2162d2e2ee58ff65e12c986ef3a8f105058-dirty", + "dirtyShortRev": "9821d21-dirty", "lastModified": 1725996724, - "narHash": "sha256-/qG2amIN/cMpkCXAM1/ThYeJgEt4Ik+gv/YOkyVa0kg=", - "ref": "refs/heads/main", - "rev": "9821d2162d2e2ee58ff65e12c986ef3a8f105058", - "revCount": 71, + "narHash": "sha256-xL7dP5DVkG56pbY9wSJ8v9gpCjtA7UfXC6MwttF8teE=", "type": "git", "url": "file:./secrets" }, diff --git a/hosts/Hevana/default.nix b/hosts/Hevana/default.nix index 53e4f79..fd98c75 100644 --- a/hosts/Hevana/default.nix +++ b/hosts/Hevana/default.nix @@ -26,6 +26,7 @@ let home-assistant.url jellyfin.url netdata.url + transmission.url ]; in { @@ -192,9 +193,13 @@ in ports = [ config.secrets.hosts.dimaga.ssh.port ]; }; transmission = { - enable = false; + enable = true; home = "${services-root}/transmission"; url = config.secrets.services.transmission.url; + auth = { + user = config.users.users.aires.name; + password = config.secrets.services.transmission.password; + }; }; virtualization.host = { enable = true; diff --git a/hosts/Khanda/hardware-configuration.nix b/hosts/Khanda/hardware-configuration.nix index 61c7e2b..0637e3d 100644 --- a/hosts/Khanda/hardware-configuration.nix +++ b/hosts/Khanda/hardware-configuration.nix @@ -105,7 +105,7 @@ in # NOTE: Results in a kernel panic on 6.10 kernels. See https://github.com/linux-surface/linux-surface/issues/1516 # ALSO: This causes a build failure on NixOS anyway. ee https://github.com/NixOS/nixpkgs/issues/303067 ipu6 = { - enable = false; + enable = true; platform = "ipu6ep"; }; }; diff --git a/modules/services/transmission.nix b/modules/services/transmission.nix index 3ce86f4..23d9a33 100644 --- a/modules/services/transmission.nix +++ b/modules/services/transmission.nix @@ -17,6 +17,18 @@ in type = lib.types.str; description = "Where to store Transmission's files"; }; + auth = { + user = lib.mkOption { + default = "transmission"; + type = lib.types.str; + description = "Username for basic auth."; + }; + password = lib.mkOption { + default = "transmission"; + type = lib.types.str; + description = "Password for basic auth."; + }; + }; url = lib.mkOption { default = ""; type = lib.types.str; @@ -32,6 +44,9 @@ in nginx.virtualHosts."${cfg.url}" = { useACMEHost = pkgs.util.getDomainFromURL cfg.url; forceSSL = true; + basicAuth = { + "${cfg.auth.user}" = cfg.auth.password; + }; locations."/" = { proxyPass = "http://127.0.0.1:9091"; extraConfig = '' @@ -48,6 +63,7 @@ in transmission = { enable = true; home = cfg.home; + downloadDirPermissions = "770"; # Required. See https://github.com/NixOS/nixpkgs/issues/183429#issuecomment-1648371683 }; }; diff --git a/secrets b/secrets index 9821d21..b086ea5 160000 --- a/secrets +++ b/secrets @@ -1 +1 @@ -Subproject commit 9821d2162d2e2ee58ff65e12c986ef3a8f105058 +Subproject commit b086ea560a8c5e2266b70710c6c2478a010f4c59