From 64620c3bf687f144b0f2169ebe2bf7766e09b4a9 Mon Sep 17 00:00:00 2001 From: David Wronek Date: Mon, 6 Oct 2025 14:59:10 +0200 Subject: [PATCH 1/2] python3Packages.sebaubuntu-libs: init at 2.0.0 Signed-off-by: David Wronek --- .../sebaubuntu-libs/default.nix | 68 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 70 insertions(+) create mode 100644 pkgs/development/python-modules/sebaubuntu-libs/default.nix diff --git a/pkgs/development/python-modules/sebaubuntu-libs/default.nix b/pkgs/development/python-modules/sebaubuntu-libs/default.nix new file mode 100644 index 000000000000..91a1429d2bcd --- /dev/null +++ b/pkgs/development/python-modules/sebaubuntu-libs/default.nix @@ -0,0 +1,68 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + nix-update-script, + android-image-kitchen, + gitpython, + poetry-core, + pyelftools, + requests, +}: + +buildPythonPackage (finalAttrs: { + pname = "sebaubuntu-libs"; + version = "2.0.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "sebaubuntu-python"; + repo = "sebaubuntu_libs"; + tag = "v${finalAttrs.version}"; + hash = "sha256-LV7Me+GmgOvDh0XGoLaftCKtP/fnB5xVqb8nArOMIys="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + gitpython + pyelftools + requests + ]; + + postPatch = '' + # Patch libaik to use AIK from nixpkgs + substituteInPlace sebaubuntu_libs/libaik/__init__.py \ + --replace-fail \ + "Repo.clone_from(AIK_REPO, self.path)" "" \ + --replace-fail \ + "unpackimg.sh" "${lib.getExe' android-image-kitchen "aik-unpackimg"}" \ + --replace-fail \ + "repack.sh" "${lib.getExe' android-image-kitchen "aik-repackimg"}" \ + --replace-fail \ + "cleanup.sh" "${lib.getExe' android-image-kitchen "aik-cleanup"}" \ + --replace-fail \ + 'command = [self.path / script, "--nosudo", *args]' \ + 'command = [script, "--nosudo", *args]' \ + --replace-fail \ + 'return check_output(command, stderr=STDOUT, universal_newlines=True, encoding="utf-8")' \ + 'return check_output(command, stderr=STDOUT, universal_newlines=True, encoding="utf-8", + cwd=self.path)' + ''; + + # Module has no tests + doCheck = false; + + pythonImportsCheck = [ "sebaubuntu_libs" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "SebaUbuntu's shared libs"; + homepage = "https://github.com/sebaubuntu-python/sebaubuntu_libs"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ ungeskriptet ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2f8c149f03c9..7cc328b84589 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -17393,6 +17393,8 @@ self: super: with self; { seatconnect = callPackage ../development/python-modules/seatconnect { }; + sebaubuntu-libs = callPackage ../development/python-modules/sebaubuntu-libs { }; + seccomp = callPackage ../development/python-modules/seccomp { }; secp256k1 = callPackage ../development/python-modules/secp256k1 { inherit (pkgs) secp256k1; }; From 2da27b8c58f189e1249902f0182e4a1cc333c94b Mon Sep 17 00:00:00 2001 From: David Wronek Date: Mon, 6 Apr 2026 21:18:37 +0200 Subject: [PATCH 2/2] dumpyara: init at 1.1.0 Signed-off-by: David Wronek --- pkgs/by-name/du/dumpyara/package.nix | 83 ++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 pkgs/by-name/du/dumpyara/package.nix diff --git a/pkgs/by-name/du/dumpyara/package.nix b/pkgs/by-name/du/dumpyara/package.nix new file mode 100644 index 000000000000..3ace3aafdc9d --- /dev/null +++ b/pkgs/by-name/du/dumpyara/package.nix @@ -0,0 +1,83 @@ +{ + lib, + runCommand, + python3Packages, + fetchFromGitHub, + callPackage, + nix-update-script, + _7zz, + android-tools, + cpio, + dumpyara, + erofs-utils, + squashfsTools, + zip, +}: +python3Packages.buildPythonApplication (finalAttrs: { + pname = "dumpyara"; + version = "1.1.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "sebaubuntu-python"; + repo = "dumpyara"; + tag = "v${finalAttrs.version}"; + hash = "sha256-V7SX1XR+De3py6B3Fmqn1IehN0sGPxUKJ0YlGpBPHG4="; + }; + + build-system = with python3Packages; [ poetry-core ]; + + dependencies = with python3Packages; [ + brotli + liblp + lz4 + protobuf5 + py7zr + sebaubuntu-libs + zstandard + ]; + + makeWrapperArgs = [ + "--prefix" + "PATH" + ":" + (lib.makeBinPath [ + _7zz + android-tools + cpio + erofs-utils + ]) + ]; + + passthru = { + tests.requiredTools = + runCommand "check-required-tools" + { + nativeBuildInputs = [ + android-tools + dumpyara + squashfsTools + zip + ]; + } + '' + echo foo > bar.txt + mkbootimg --kernel bar.txt -o boot.img + mksquashfs bar.txt system.img + zip system.zip *.img + dumpyara system.zip + touch $out + ''; + updateScript = nix-update-script { }; + }; + + __structuredAttrs = true; + + meta = { + description = "Android firmware dumper"; + homepage = "https://github.com/sebaubuntu-python/dumpyara"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ ungeskriptet ]; + mainProgram = "dumpyara"; + }; +})