From f887f639e2354991fbcc2e39f8fae42dd0db0c72 Mon Sep 17 00:00:00 2001 From: Dan Lock Date: Tue, 17 Mar 2026 20:07:40 +0000 Subject: [PATCH] nixos/bitmagnet: Use up to date configuration values, and open http port, add restart trigger --- nixos/modules/services/torrent/bitmagnet.nix | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/torrent/bitmagnet.nix b/nixos/modules/services/torrent/bitmagnet.nix index 13369dab1f79..d2e140131df3 100644 --- a/nixos/modules/services/torrent/bitmagnet.nix +++ b/nixos/modules/services/torrent/bitmagnet.nix @@ -14,8 +14,8 @@ let optional ; inherit (lib.types) + nullOr bool - int port str submodule @@ -44,10 +44,10 @@ in type = submodule { inherit freeformType; options = { - port = mkOption { + local_address = mkOption { type = str; default = ":3333"; - description = "HTTP server listen port"; + description = "HTTP server listen address"; }; }; }; @@ -95,6 +95,20 @@ in }; }; }; + tmdb = mkOption { + default = { }; + description = "TMDB api settings"; + type = submodule { + inherit freeformType; + options = { + api_key = mkOption { + type = nullOr str; + default = null; + description = "TMDB api key, to avoid api limits. Leave null to use the default shared key."; + }; + }; + }; + }; }; }; }; @@ -130,6 +144,7 @@ in ] ++ optional cfg.useLocalPostgresDB "postgresql.target"; requires = optional cfg.useLocalPostgresDB "postgresql.target"; + restartTriggers = [ config.environment.etc."xdg/bitmagnet/config.yml".source ]; serviceConfig = { Type = "simple"; DynamicUser = true; @@ -139,6 +154,7 @@ in Restart = "on-failure"; WorkingDirectory = "/var/lib/bitmagnet"; StateDirectory = "bitmagnet"; + BindReadOnlyPaths = [ "/etc/xdg/bitmagnet/config.yml" ]; # Sandboxing (sorted by occurrence in https://www.freedesktop.org/software/systemd/man/systemd.exec.html) ProtectSystem = "strict";