From bb2ae01ef06ec5d7e5765cf3e9494439900b5d73 Mon Sep 17 00:00:00 2001 From: S0AndS0 Date: Sun, 7 Sep 2025 12:35:53 -0700 Subject: [PATCH] radio-active: init at 2.9.1 Internally adds `zenlog` which, in the future, may break due to `colorlog` introducing breaking-changes. Hence why for the commented code in that section. Searching if any other packages have this dependency did not result in results; ```bash shopt -s globstar; grep -rEn -- zenlog pkgs/**/*.nix; ``` Overrides and pins `pyradios` to version `1.0.2` because without this the main application complains during install time. Main package `src` is obtained via `fetchFromGitHub` because I forked it to enable XDG configuration directory support as well as reduce need of declaring defaults. Once deep5050/radio-active#124 is accepted, or rejected, we can revisit the `src` value. Attributions; - @qzylinra for making code look pretty - @SuperSandro2000 for encouraging `zenlog` to be packaged separately --- pkgs/by-name/ra/radio-active/package.nix | 68 ++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 pkgs/by-name/ra/radio-active/package.nix diff --git a/pkgs/by-name/ra/radio-active/package.nix b/pkgs/by-name/ra/radio-active/package.nix new file mode 100644 index 000000000000..e78d6872c5f1 --- /dev/null +++ b/pkgs/by-name/ra/radio-active/package.nix @@ -0,0 +1,68 @@ +{ + lib, + python3Packages, + fetchFromGitHub, + ffmpeg, +}: + +let + ## https://github.com/deep5050/radio-active/blob/main/requirements.txt + pyradios_1-0-2 = python3Packages.pyradios.overrideAttrs ( + finalAttrs: previousAttrs: + let + version = "1.0.2"; + in + { + inherit version; + + src = previousAttrs.src.override { + inherit version; + hash = "sha256-O30ExmvWu4spwDytFVPWGjR8w3XSTaWd2Z0LGQibq9g="; + }; + } + ); + + pname = "radio-active"; + version = "2.9.1"; +in +python3Packages.buildPythonApplication { + inherit pname version; + pyproject = true; + + src = fetchFromGitHub { + owner = "S0AndS0"; + repo = "radio-active"; + rev = "2befa6a309d9c411ef1ea522e706ed3e098e5341"; + hash = "sha256-wqETmdqvxsKnjkjQADq59J83QkOhLA74SPtuWTpsvO0="; + }; + + postPatch = '' + substituteInPlace radioactive/recorder.py \ + --replace-fail '"ffmpeg",' '"${lib.getExe ffmpeg}",' + + substituteInPlace radioactive/ffplay.py \ + --replace-fail 'self.exe_path = which(self.program_name)' \ + 'self.exe_path = "${ffmpeg.outPath}/bin/ffplay"' + ''; + + build-system = with python3Packages; [ setuptools ]; + + dependencies = with python3Packages; [ + requests + urllib3 + psutil + pyradios_1-0-2 + zenlog + requests-cache + rich + pick + ]; + + meta = { + description = "Play any radios from around the globe right from the terminal"; + homepage = "https://www.radio-browser.info/"; + changelog = "https://github.com/deep5050/radio-active/releases/tag/v${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ S0AndS0 ]; + }; +}