{ lib, buildPythonPackage, fetchFromGitHub, pytestCheckHook, rustPlatform, }: buildPythonPackage rec { pname = "imgsize"; version = "4.1.0"; pyproject = true; src = fetchFromGitHub { owner = "ojii"; repo = "imgsize"; tag = version; hash = "sha256-5EpmZMszpubl3/vyCufADLwNlrHN3JwnLlLzR4xN2fw="; }; cargoDeps = rustPlatform.fetchCargoVendor { inherit pname version src; hash = "sha256-I62N8iW0CZ2UVzUSqCnOto1otmmRANa4SKszbHBk39w="; }; nativeBuildInputs = [ rustPlatform.cargoSetupHook rustPlatform.maturinBuildHook ]; nativeCheckInputs = [ pytestCheckHook ]; # remove useless dev setup in conftest.py preCheck = '' substituteInPlace python-tests/conftest.py \ --replace-fail 'assert sys.prefix != sys.base_prefix, "must be in virtualenv"' "" \ --replace-fail 'check_call(' "# " ''; meta = { description = "Pure Python image size library"; homepage = "https://github.com/ojii/imgsize"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ twey ]; }; }