nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 rustPlatform,
6 pytestCheckHook,
7 pytest-benchmark,
8 nix-update-script,
9}:
10let
11 pname = "fastcrc";
12 version = "0.3.5";
13
14 src = fetchFromGitHub {
15 owner = "overcat";
16 repo = "fastcrc";
17 tag = "v${version}";
18 hash = "sha256-Q1R0EgxrfCMn/DxblOAW4Z7YOxpaZPL5Sx8SL/dry98=";
19 };
20in
21buildPythonPackage {
22 inherit pname version src;
23 pyproject = true;
24
25 nativeBuildInputs = with rustPlatform; [
26 cargoSetupHook
27 maturinBuildHook
28 ];
29
30 cargoDeps = rustPlatform.fetchCargoVendor {
31 inherit pname version src;
32 hash = "sha256-dWxQuWV3w1UM8yvLG/9SrJQxSSyWTXV0FWFDKjIHBf0=";
33 };
34
35 pythonImportsCheck = [ "fastcrc" ];
36
37 nativeCheckInputs = [
38 pytestCheckHook
39 pytest-benchmark
40 ];
41
42 pytestFlags = [ "--benchmark-disable" ];
43
44 # Python source files interfere with testing
45 preCheck = ''
46 rm -r fastcrc
47 '';
48
49 passthru.updateScript = nix-update-script { };
50
51 meta = {
52 description = "Hyper-fast Python module for computing CRC(8, 16, 32, 64) checksum";
53 homepage = "https://fastcrc.readthedocs.io/en/latest/";
54 license = lib.licenses.mit;
55 maintainers = with lib.maintainers; [ pluiedev ];
56 };
57}