I am trying to package slidge but I connot trick nix to thing its dependency thumbhash is installed.
default.nix like this:
{
python3Packages,
fetchFromGitea,
fetchFromGitHub,
writeText,
}:
let
thumbhash = python3Packages.buildPythonPackage (finalAttrs: {
pname = "thumbhash";
version = "0.1.2";
pyproject = true;
src = fetchFromGitHub {
owner = "justinforlenza";
repo = "thumbhash-py";
tag = "v0.1.2";
hash = "sha256-caOMW2hB+Be0SJToWrE51qb+ex/iVRH29oHwfsIcTXw=";
};
build-system = with python3Packages; [
hatchling
];
dependencies = with python3Packages; [
pillow
];
doCheck = false;
pythonImportsCheck = [ "thumbhash" ];
patches = [
(writeText "pyproject-fix.patch" ''
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -49,6 +49,9 @@ dependencies = [
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=thumbhash --cov=tests {args}"
no-cov = "cov --no-cov {args}"
+[tool.hatch.build.targets.wheel]
+packages = ["thumbhash"]
+
[[tool.hatch.envs.test.matrix]]
python = ["37", "38", "39", "310", "311"]
'')
];
meta = {
# ...
};
});
in
python3Packages.buildPythonPackage (finalAttrs: {
pname = "slidge";
version = "0.3.11";
pyproject = true;
# dontCheckRuntimeDeps = true; # it cannot detech thumbhash installation
src = fetchFromGitea {
domain = "codeberg.org";
owner = "slidge";
repo = "slidge";
tag = "v${finalAttrs.version}";
hash = "sha256-IUfeNn/zp1iyMSu60VAtJ5A74Q9zTh37B+LFNa6VVLA=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'pillow~=11.0' 'pillow' \
--replace-fail 'defusedxml~=0.7.1' 'defusedxml' \
--replace-fail 'slixmpp~=1.14.1' 'slixmpp'
'';
build-system = with python3Packages; [
setuptools-scm
];
dependencies =
with python3Packages;
[
slixmpp
aiohttp
qrcode
configargparse
blurhash
alembic
defusedxml
pillow
python-magic
sqlalchemy
]
++ [
thumbhash
];
meta = {
# ...
};
})
When running nix-build --expr 'with import <nixpkgs> {}; callPackage ./default.nix {}' in the same folder, It throws error:
Successfully built slidge-0.3.11-py3-none-any.whl
Finished creating a wheel...
Finished executing pypaBuildPhase
Running phase: pythonRuntimeDepsCheckHook
@nix { "action": "setPhase", "phase": "pythonRuntimeDepsCheckHook" }
Executing pythonRuntimeDepsCheck
Checking runtime dependencies for slidge-0.3.11-py3-none-any.whl
- thumbhash not installed
I cannot pass pythonRuntimeDepsCheck to trick thumbhash is installed unless I set dontCheckRuntimeDeps = true; and I think it is not a good solution. How can I solve this problem? Thanks!