From 166caa0b207bf3bf0caca03d25ac752fdf390cb0 Mon Sep 17 00:00:00 2001 From: bdim Date: Tue, 9 Dec 2025 16:21:58 +0800 Subject: [PATCH 1/3] pywidevine: init at 1.8.0 Python implementation of Google's Widevine DRM CDM (Content Decryption Module). Includes a patch for construct 2.10+ compatibility. Co-authored-by: Yohann Boniface --- .../construct-2.10-compatibility.patch | 20 +++++++ .../python-modules/pywidevine/default.nix | 54 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 76 insertions(+) create mode 100644 pkgs/development/python-modules/pywidevine/construct-2.10-compatibility.patch create mode 100644 pkgs/development/python-modules/pywidevine/default.nix diff --git a/pkgs/development/python-modules/pywidevine/construct-2.10-compatibility.patch b/pkgs/development/python-modules/pywidevine/construct-2.10-compatibility.patch new file mode 100644 index 0000000000000..dc83e11ae27c8 --- /dev/null +++ b/pkgs/development/python-modules/pywidevine/construct-2.10-compatibility.patch @@ -0,0 +1,20 @@ +--- a/pywidevine/device.py ++++ b/pywidevine/device.py +@@ -33,7 +33,7 @@ class _Structures: + # - Removed vmp and vmp_len as it should already be within the Client ID + v2 = Struct( + "signature" / magic, +- "version" / Const(Int8ub, 2), ++ "version" / Const(2, Int8ub), + "type_" / CEnum( + Int8ub, + **{t.name: t.value for t in DeviceTypes} +@@ -50,7 +50,7 @@ class _Structures: + # - Removed system_id as it can be retrieved from the Client ID's DRM Certificate + v1 = Struct( + "signature" / magic, +- "version" / Const(Int8ub, 1), ++ "version" / Const(1, Int8ub), + "type_" / CEnum( + Int8ub, + **{t.name: t.value for t in DeviceTypes} diff --git a/pkgs/development/python-modules/pywidevine/default.nix b/pkgs/development/python-modules/pywidevine/default.nix new file mode 100644 index 0000000000000..5bd9a3569940a --- /dev/null +++ b/pkgs/development/python-modules/pywidevine/default.nix @@ -0,0 +1,54 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + poetry-core, + pycryptodome, + protobuf, + requests, + pyyaml, + unidecode, + click, + pymp4, + construct, +}: + +buildPythonPackage { + pname = "pywidevine"; + version = "1.8.0"; + pyproject = true; + + src = fetchPypi { + pname = "pywidevine"; + version = "1.8.0"; + hash = "sha256-wU8/4oZEc0FrnKpz2aISUaAtchOObVTYwaP0S3prBck="; + }; + + patches = [ + ./construct-2.10-compatibility.patch + ]; + + pythonRelaxDeps = [ "protobuf" ]; + + build-system = [ poetry-core ]; + + dependencies = [ + click + construct + protobuf + pycryptodome + pymp4 + pyyaml + requests + unidecode + ]; + + doCheck = false; + + meta = { + description = "Python implementation of Google's Widevine CDM"; + homepage = "https://github.com/devine-project/pywidevine"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ bdim404 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 037b08734c753..133fa9fec0ff8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15164,6 +15164,8 @@ self: super: with self; { pywfa = callPackage ../development/python-modules/pywfa { }; + pywidevine = callPackage ../development/python-modules/pywidevine { }; + pywikibot = callPackage ../development/python-modules/pywikibot { }; pywilight = callPackage ../development/python-modules/pywilight { }; From 7b52e3eb05b9b3a90cdc8d375dee24e35628b930 Mon Sep 17 00:00:00 2001 From: bdim Date: Tue, 9 Dec 2025 16:22:08 +0800 Subject: [PATCH 2/3] pymp4: init at 1.4.0 Python library for parsing and manipulating MP4 files. Uses the devine-dl fork with construct 2.10+ compatibility from upstream PR #24. --- .../python-modules/pymp4/default.nix | 38 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 40 insertions(+) create mode 100644 pkgs/development/python-modules/pymp4/default.nix diff --git a/pkgs/development/python-modules/pymp4/default.nix b/pkgs/development/python-modules/pymp4/default.nix new file mode 100644 index 0000000000000..fd1274abfc291 --- /dev/null +++ b/pkgs/development/python-modules/pymp4/default.nix @@ -0,0 +1,38 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + construct, + pytestCheckHook, +}: + +buildPythonPackage { + pname = "pymp4"; + version = "1.4.0-unstable-2023-08-07"; + pyproject = true; + + src = fetchFromGitHub { + owner = "devine-dl"; + repo = "pymp4"; + rev = "33dc5d620f361cb49d713b60dcb2686ab8696f91"; + hash = "sha256-tPIbehjYHg5+S62sorsWow+u/eBkqJYf6xMI8q4vEgY="; + }; + + pythonRelaxDeps = [ "construct" ]; + + build-system = [ poetry-core ]; + + dependencies = [ construct ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + doCheck = false; + + meta = { + description = "Python library for parsing and manipulating MP4 files"; + homepage = "https://github.com/beardypig/pymp4"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ bdim404 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 133fa9fec0ff8..4d666e77b0b52 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13328,6 +13328,8 @@ self: super: with self; { pymorphy3-dicts-uk = callPackage ../development/python-modules/pymorphy3/dicts-uk.nix { }; + pymp4 = callPackage ../development/python-modules/pymp4 { }; + pympler = callPackage ../development/python-modules/pympler { }; pymsgbox = callPackage ../development/python-modules/pymsgbox { }; From 62ce14815bcf2f2955ca2d8c196beb055e5ed5c6 Mon Sep 17 00:00:00 2001 From: bdim Date: Tue, 9 Dec 2025 16:22:17 +0800 Subject: [PATCH 3/3] gamdl: init at 2.8 Command-line tool for downloading Apple Music songs, music videos and post videos. Automatically embeds metadata, lyrics, and cover art. Co-authored-by: Yohann Boniface --- pkgs/by-name/ga/gamdl/package.nix | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 pkgs/by-name/ga/gamdl/package.nix diff --git a/pkgs/by-name/ga/gamdl/package.nix b/pkgs/by-name/ga/gamdl/package.nix new file mode 100644 index 0000000000000..20d65b0c81935 --- /dev/null +++ b/pkgs/by-name/ga/gamdl/package.nix @@ -0,0 +1,48 @@ +{ + lib, + python3Packages, + fetchFromGitHub, +}: + +python3Packages.buildPythonApplication { + pname = "gamdl"; + version = "2.8"; + pyproject = true; + + src = fetchFromGitHub { + owner = "glomatico"; + repo = "gamdl"; + rev = "37c857b503ca9ea32c4b39669bbb2d23064f39ff"; + hash = "sha256-uwl/K0KbZKwJ8mxiQOP+nGB3I69X5wv3HhfxBiiv/VM="; + }; + + pythonRelaxDeps = [ + "click" + "pillow" + "yt-dlp" + ]; + + build-system = with python3Packages; [ setuptools ]; + + dependencies = with python3Packages; [ + async-lru + click + httpx + inquirerpy + m3u8 + mutagen + pillow + pywidevine + yt-dlp + ]; + + doCheck = false; # no tests + + meta = { + description = "Command-line app for downloading Apple Music songs, music videos and post videos"; + homepage = "https://github.com/glomatico/gamdl"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ bdim404 ]; + platforms = lib.platforms.all; + }; +}