diff --git a/hosts/fw/modules/pyload.nix b/hosts/fw/modules/pyload.nix index 616e9e5..96c48c1 100644 --- a/hosts/fw/modules/pyload.nix +++ b/hosts/fw/modules/pyload.nix @@ -178,6 +178,7 @@ in environment.systemPackages = with pkgs; [ unrar # Required for RAR archive extraction + p7zip # Required for 7z and other archive formats filebot # Automated media file organization ]; @@ -234,9 +235,16 @@ in }; }; - # Disable SSL certificate verification + # Configure pyload service systemd.services.pyload = { + # Add extraction tools to service PATH + path = with pkgs; [ + unrar # For RAR extraction + p7zip # For 7z extraction + ]; + environment = { + # Disable SSL certificate verification PYLOAD__GENERAL__SSL_VERIFY = "0"; # Enable ExtractArchive plugin @@ -248,7 +256,7 @@ in PYLOAD__EXTRACTARCHIVE__FULLPATH = "1"; }; - # Bind-mount DNS configuration files and system tools into the chroot + # Bind-mount DNS configuration files into the chroot serviceConfig = { BindReadOnlyPaths = [ "/etc/resolv.conf" @@ -256,8 +264,6 @@ in "/etc/hosts" "/etc/ssl" "/etc/static/ssl" - # Make all system packages (including unrar and filebot) accessible - "/run/current-system/sw/bin" ]; }; }; diff --git a/utils/overlays/packages.nix b/utils/overlays/packages.nix index 811ae3b..56e0abf 100644 --- a/utils/overlays/packages.nix +++ b/utils/overlays/packages.nix @@ -14,7 +14,7 @@ self: super: { }; python3Packages = self.python3.pkgs; - pyload-ng = self.callPackage ../pkgs/pyload-ng-updated.nix { pyload-ng = super.pyload-ng; }; + pyload-ng = self.callPackage ../pkgs/pyload-ng { pyload-ng = super.pyload-ng; }; # vscode-insiders = (super.callPackage ../pkgs/vscode-insiders.nix { }); } diff --git a/utils/pkgs/pyload-ng-updated.nix b/utils/pkgs/pyload-ng/default.nix similarity index 90% rename from utils/pkgs/pyload-ng-updated.nix rename to utils/pkgs/pyload-ng/default.nix index 195eebf..01003bf 100644 --- a/utils/pkgs/pyload-ng-updated.nix +++ b/utils/pkgs/pyload-ng/default.nix @@ -10,6 +10,10 @@ pyload-ng.overridePythonAttrs (oldAttrs: rec { hash = "sha256-g1eEeNnr3Axtr+0BJzMcNQomTEX4EsUG1Jxt+huPyoc="; }; + patches = [ + ./patches/declarative-env-config.patch + ]; + # Add new dependencies required in newer versions propagatedBuildInputs = (oldAttrs.propagatedBuildInputs or []) ++ (with python3Packages; [ mini-racer diff --git a/utils/pkgs/pyload-ng/patches/declarative-env-config.patch b/utils/pkgs/pyload-ng/patches/declarative-env-config.patch new file mode 100644 index 0000000..589a041 --- /dev/null +++ b/utils/pkgs/pyload-ng/patches/declarative-env-config.patch @@ -0,0 +1,38 @@ +diff --git a/src/pyload/core/__init__.py b/src/pyload/core/__init__.py +index 4324fc700..5d915a85e 100644 +--- a/src/pyload/core/__init__.py ++++ b/src/pyload/core/__init__.py +@@ -130,6 +130,14 @@ class Core: + else: + self._debug = max(0, int(debug)) + ++ # Process core config environment variables (NixOS declarative config) ++ for env, value in os.environ.items(): ++ if not env.startswith("PYLOAD__"): ++ continue ++ parts = env.removeprefix("PYLOAD__").lower().split("__", 1) ++ if len(parts) == 2 and parts[0] in self.config.config: ++ self.config.set(parts[0], parts[1], value) ++ + # If no argument set, read storage dir from config file, + # otherwise save setting to config dir + if storagedir is None: +@@ -227,6 +235,18 @@ class Core: + self.thm = self.thread_manager = ThreadManager(self) + self.cpm = self.captcha_manager = CaptchaManager(self) + self.adm = self.addon_manager = AddonManager(self) ++ ++ # Process plugin config environment variables after plugins are loaded (NixOS declarative config) ++ # Build case-insensitive lookup map for plugin names ++ plugin_name_map = {name.lower(): name for name in self.config.plugin.keys()} ++ ++ for env, value in os.environ.items(): ++ if not env.startswith("PYLOAD__"): ++ continue ++ parts = env.removeprefix("PYLOAD__").lower().split("__", 1) ++ if len(parts) == 2 and parts[0] in plugin_name_map: ++ actual_plugin_name = plugin_name_map[parts[0]] ++ self.config.set_plugin(actual_plugin_name, parts[1], value) + + def _setup_permissions(self): + self.log.debug("Setup permissions...")