Skip to content

Commit e3d21ee

Browse files
committed
python3Packages.rembg: fix cuda build
1 parent 27af567 commit e3d21ee

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

pkgs/development/python-modules/rembg/default.nix

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@
3333

3434
# tests
3535
versionCheckHook,
36+
pocl,
3637

3738
withCli ? false,
39+
config,
40+
cudaSupport ? config.cudaSupport,
41+
writableTmpDirAsHomeHook,
3842
}:
3943

4044
let
@@ -100,9 +104,17 @@ buildPythonPackage (finalAttrs: {
100104
postInstall = lib.optionalString (!withCli) "rm -r $out/bin";
101105

102106
# not running python tests, as they require network access
103-
nativeCheckInputs = lib.optionals withCli [
104-
versionCheckHook
105-
];
107+
nativeCheckInputs =
108+
lib.optionals withCli [
109+
versionCheckHook
110+
]
111+
++ lib.optionals cudaSupport [
112+
# Provides a CPU-based OpenCL ICD so that pyopencl's module-level
113+
# cl.create_some_context() succeeds without GPU hardware.
114+
pocl
115+
# pocl needs a writable $HOME for its kernel cache directory.
116+
writableTmpDirAsHomeHook
117+
];
106118
versionCheckKeepEnvironment = [
107119
# Otherwise, fail with:
108120
# RuntimeError: cannot cache function '_make_tree': no locator available for file

0 commit comments

Comments
 (0)