Need help to package slidge-whatsapp

Yesterday I found I can build the package with devenv environment with uv package and just run uv build to build it from source in codeberg easily, then I can get a .whl file inside a dist folder.

However I cannot able to do it in nix way, as manually running the gopy build command in the build.py file outside the uv build environment do not work. It throws error about something like this: # github.com/gen2brain/go-fitz | /go/pkg/mod/github.com/gen2brain/go-fitz@v1.18.0/fitz.go:8:10: fatal error: mupdf/fitz.h: No such file or directory · Issue #41 · gen2brain/go-fitz · GitHub

Not only that, doing it in buildGoModule don’t work in another way because it do not have internet access i guess because of GOPROXY=off issue. Manually setting GOPROXY to point to some manually crafted goModules also not help.

Today I learned what .whl actually is as I don’t know much about python, and I figured out fetchPypi can fetch wheel and not the source, so I came up another way to package it.

{
  fetchPypi,
  python3Packages,
  python3,
  ...
}:
let
  # from pkgs/development/python-modules/clarifai-protocol/default.nix
  pythonVersionNoDot = builtins.replaceStrings [ "." ] [ "" ] python3.pythonVersion;
in
python3Packages.buildPythonPackage (finalAttrs: {
  pname = "slidge-whatsapp";
  version = "0.3.11";
  format = "wheel";

  src = fetchPypi {
    format = "wheel";
    pname = "slidge_whatsapp";
    version = finalAttrs.version;
    python = "cp${pythonVersionNoDot}";
    abi = "cp${pythonVersionNoDot}";
    dist = "cp${pythonVersionNoDot}";
    platform = "manylinux_2_41_x86_64";
    hash = "sha256-SbnRWbp2xnBg5lSNMUqwZZ0NzLQg+pOg+51LzSFr5bY=";
  };

  propagatedBuildInputs = [
    (import ../slidge)
    (import ../linkpreview)
  ];

  meta = {
    # #...
  };
})

I just switch the src with my local build .whl file.

Dependencies slidge and linkpreview need to be packaged, which is not hard. I also got help to package slidge yesterday here; Need help for packaging python package (package not installed error)

I am now just able to get ./result/bin/slidge-whatsapp to show some proper help message, but I have to set things up to see if it actually works.