From 5111a03c0a0ed67d5d7e1756ff69d18e6e415a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 19 Aug 2026 18:53:48 +0200 Subject: [PATCH 1/2] dlib: test python dlib package in passthru --- pkgs/by-name/dl/dlib/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/dl/dlib/package.nix b/pkgs/by-name/dl/dlib/package.nix index 09f039d698ec..9372713c7ae0 100644 --- a/pkgs/by-name/dl/dlib/package.nix +++ b/pkgs/by-name/dl/dlib/package.nix @@ -17,6 +17,7 @@ avxSupport ? stdenv.hostPlatform.avxSupport, cudaSupport ? config.cudaSupport, cudaPackages, + python3Packages, }@inputs: (if cudaSupport then cudaPackages.backendStdenv else inputs.stdenv).mkDerivation rec { pname = "dlib"; @@ -81,6 +82,9 @@ ); passthru = { + tests = { + python-dlib = python3Packages.dlib; + }; inherit cudaSupport cudaPackages From 352bd28c5370328a7e633fe6b1cfe8edff6d6945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 19 Aug 2026 18:55:37 +0200 Subject: [PATCH 2/2] python314Packages.dlib: fix build after dlib 20.0.1 bump --- .../python-modules/dlib/build-cores.patch | 10 ++++----- .../python-modules/dlib/default.nix | 22 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pkgs/development/python-modules/dlib/build-cores.patch b/pkgs/development/python-modules/dlib/build-cores.patch index 072519975c43..a4714c8147a6 100644 --- a/pkgs/development/python-modules/dlib/build-cores.patch +++ b/pkgs/development/python-modules/dlib/build-cores.patch @@ -1,8 +1,8 @@ diff --git a/setup.py b/setup.py -index 219583b..3ca5f88 100644 +index 59b65a62..363c9e56 100644 --- a/setup.py +++ b/setup.py -@@ -170,23 +170,7 @@ class CMakeBuild(build_ext): +@@ -217,23 +217,7 @@ def build_extension(self, ext): subprocess.check_call(cmake_build, cwd=build_folder) def num_available_cpu_cores(ram_per_build_process_in_gb): @@ -13,9 +13,9 @@ index 219583b..3ca5f88 100644 - elif 'CMAKE_BUILD_PARALLEL_LEVEL' in os.environ and os.environ['CMAKE_BUILD_PARALLEL_LEVEL'].isnumeric(): - return int(os.environ['CMAKE_BUILD_PARALLEL_LEVEL']) - try: -- mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') +- mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') - mem_gib = mem_bytes/(1024.**3) -- num_cores = multiprocessing.cpu_count() +- num_cores = multiprocessing.cpu_count() - # make sure we have enough ram for each build process. - mem_cores = int(floor(mem_gib/float(ram_per_build_process_in_gb)+0.5)); - # We are limited either by RAM or CPU cores. So pick the limiting amount @@ -26,4 +26,4 @@ index 219583b..3ca5f88 100644 + return os.getenv("NIX_BUILD_CORES", 1) - from setuptools.command.test import test as TestCommand + def read_version_from_cmakelists(cmake_file): diff --git a/pkgs/development/python-modules/dlib/default.nix b/pkgs/development/python-modules/dlib/default.nix index 5868705f1127..c71bda7617fe 100644 --- a/pkgs/development/python-modules/dlib/default.nix +++ b/pkgs/development/python-modules/dlib/default.nix @@ -1,8 +1,9 @@ { buildPythonPackage, + cmake, dlib, pytestCheckHook, - more-itertools, + setuptools, }: buildPythonPackage.override { inherit (dlib) stdenv; } { @@ -17,21 +18,14 @@ buildPythonPackage.override { inherit (dlib) stdenv; } { meta ; - format = "setuptools"; - patches = [ ./build-cores.patch ]; - nativeCheckInputs = [ - pytestCheckHook - more-itertools + pyproject = true; + build-system = [ + cmake + setuptools ]; - postPatch = '' - substituteInPlace setup.py \ - --replace "more-itertools<6.0.0" "more-itertools" \ - --replace "pytest==3.8" "pytest" - ''; - # Pass CMake flags through to the build script preConfigure = '' for flag in $cmakeFlags; do @@ -43,6 +37,10 @@ buildPythonPackage.override { inherit (dlib) stdenv; } { dontUseCmakeConfigure = true; + nativeCheckInputs = [ + pytestCheckHook + ]; + doCheck = !( # The tests attempt to use CUDA on the build platform.