{ lib, buildPythonPackage, capstone, cmake, fetchFromGitHub, setuptools, setuptools-scm, stdenv, comfyui, }: let funchookVersion = "1.1.3"; funchook = fetchFromGitHub { owner = "kubo"; repo = "funchook"; tag = "v${funchookVersion}"; fetchSubmodules = true; hash = "sha256-u/RXMNyKL6L7p5gEFnAQTErPXXGKXv74jbYlBbG0Wy4="; }; in buildPythonPackage (finalAttrs: { pname = "comfy-aimdo"; version = "0.5.6"; pyproject = true; # nixpkgs-update: no auto update # updated via comfyui src = fetchFromGitHub { owner = "Comfy-Org"; repo = "comfy-aimdo"; tag = "v${finalAttrs.version}"; hash = "sha256-UzHdqf3BNFtRRJC4PRGftFuQUdGpDRHAEYLZvvu6rUM="; }; postPatch = '' chmod +x scripts/*.sh patchShebangs scripts/*.sh substituteInPlace scripts/build-linux-aimdo.sh \ --replace-fail '-j"$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)"' '-j$NIX_BUILD_CORES' mkdir build cp -r ${funchook} build/funchook-${funchookVersion} mkdir -p build/funchook-${funchookVersion}-capstone cp -r ${capstone.src} build/funchook-${funchookVersion}-capstone/capstone-src chmod -R +w build ''; nativeBuildInputs = [ cmake ]; dontUseCmakeConfigure = true; build-system = [ setuptools setuptools-scm ]; # The native library is Linux/Windows only; on other platforms the Python # module is still importable and ComfyUI falls back to its legacy offloader. preBuild = lib.optionalString stdenv.hostPlatform.isLinux '' ./scripts/build-linux-aimdo.sh ''; # Upstream ships no test suite at this tag. doCheck = false; pythonImportsCheck = [ "comfy_aimdo" ]; meta = { description = "AI model dynamic offloader for ComfyUI"; homepage = "https://github.com/Comfy-Org/comfy-aimdo"; license = lib.licenses.gpl3Only; platforms = lib.platforms.linux ++ lib.platforms.darwin; inherit (comfyui.meta) maintainers; }; })