1{ buildPythonPackage
2, fetchFromGitHub
3, lib
4, libjpeg
5, numba
6, opencv4
7, pandas
8, pkg-config
9, pytorch-pfn-extras
10, terminaltables
11, tqdm
12}:
13
14buildPythonPackage rec {
15 pname = "ffcv";
16 version = "1.0.0";
17
18 src = fetchFromGitHub {
19 owner = "libffcv";
20 repo = pname;
21 rev = "refs/tags/v${version}";
22 hash = "sha256-L2mwGFivq/gtAw+1D6U2jbW6VxYgetHX7OUrjwyybqE=";
23 };
24
25 # See https://github.com/libffcv/ffcv/issues/159.
26 postPatch = ''
27 substituteInPlace setup.py \
28 --replace "'assertpy'," "" \
29 --replace "'fastargs'," "" \
30 --replace "'imgcat'," "" \
31 --replace "'matplotlib'," "" \
32 --replace "'psutil'," "" \
33 --replace "'sklearn'," "" \
34 --replace "'webdataset'," ""
35 '';
36
37 nativeBuildInputs = [ pkg-config ];
38 buildInputs = [ libjpeg ];
39 propagatedBuildInputs = [ opencv4 numba pandas pytorch-pfn-extras terminaltables tqdm ];
40
41 # `ffcv._libffcv*.so` cannot be loaded in the nix build environment for some
42 # reason. See https://github.com/NixOS/nixpkgs/pull/160441#issuecomment-1045204722.
43 doCheck = false;
44
45 pythonImportsCheck = [ "ffcv" ];
46
47 meta = with lib; {
48 description = "FFCV: Fast Forward Computer Vision";
49 homepage = "https://ffcv.io";
50 license = licenses.asl20;
51 maintainers = with maintainers; [ samuela ];
52 };
53}