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; };