CI / Nix Flake Check (pull_request) Failing after 42s
CI / Build Packages (default) (pull_request) Successful in 49s
CI / Build Packages (example-a) (pull_request) Successful in 52s
CI / Build Packages (example-b) (pull_request) Successful in 48s
CI / Build Packages (pyzotero) (pull_request) Successful in 52s
CI / Build Packages (pyzotero-cli) (pull_request) Successful in 1m1s
138 lines
3.1 KiB
Nix
138 lines
3.1 KiB
Nix
{
|
|
lib,
|
|
callPackage,
|
|
cudaPackages_13,
|
|
fetchFromGitHub,
|
|
makeBinaryWrapper,
|
|
python3,
|
|
stdenvNoCC,
|
|
withManager ? false,
|
|
}:
|
|
|
|
let
|
|
# Same as nixpkgs comfyui, but with cudaSupport=true so torch builds with
|
|
# CUDA (the nixpkgs version only sets cudaPackages, not cudaSupport, so torch
|
|
# builds CPU-only and comfyui crashes with "Torch not compiled with CUDA").
|
|
python = python3.override {
|
|
self = python;
|
|
packageOverrides = final: prev: {
|
|
torch = prev.torch.override {
|
|
cudaSupport = true;
|
|
cudaPackages = cudaPackages_13;
|
|
};
|
|
triton = prev.triton.override {
|
|
cudaSupport = true;
|
|
cudaPackages = cudaPackages_13;
|
|
};
|
|
};
|
|
};
|
|
|
|
appDependencies =
|
|
ps:
|
|
with ps;
|
|
[
|
|
aiohttp
|
|
alembic
|
|
av
|
|
blake3
|
|
comfy-aimdo
|
|
comfy-angle
|
|
comfy-kitchen
|
|
comfyui-embedded-docs
|
|
comfyui-frontend-package
|
|
comfyui-workflow-templates
|
|
einops
|
|
filelock
|
|
kornia
|
|
numpy
|
|
pillow
|
|
psutil
|
|
pydantic
|
|
pydantic-settings
|
|
pyopengl
|
|
pyyaml
|
|
requests
|
|
safetensors
|
|
scipy
|
|
sentencepiece
|
|
simpleeval
|
|
spandrel
|
|
sqlalchemy
|
|
tokenizers
|
|
torch
|
|
torchaudio
|
|
torchsde
|
|
torchvision
|
|
tqdm
|
|
transformers
|
|
yarl
|
|
]
|
|
++ lib.optionals withManager [
|
|
ps.comfyui-manager
|
|
];
|
|
|
|
pythonEnv = python.withPackages appDependencies;
|
|
in
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "comfyui";
|
|
version = "0.30.1";
|
|
|
|
strictDeps = true;
|
|
__structuredAttrs = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "Comfy-Org";
|
|
repo = "ComfyUI";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-z8bBKnW2iF8WXI3Ju6Ei+8YpOWqmbUgYiErKiVBBwEk=";
|
|
};
|
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
|
|
|
patches = [ ./use-writable-runtime-paths.patch ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/share/comfyui $out/bin
|
|
cp -r . $out/share/comfyui
|
|
|
|
makeBinaryWrapper ${lib.getExe pythonEnv} $out/bin/comfyui \
|
|
--add-flag "$out/share/comfyui/main.py" \
|
|
--unset NIX_PYTHONPATH \
|
|
--unset PYTHONPATH
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
installCheckPhase = ''
|
|
runHook preInstallCheck
|
|
|
|
PYTHONPATH=${pythonEnv}/${python.sitePackages} ${lib.getExe python.pkgs.pip} install --break-system-packages --dry-run --no-index -r requirements.txt
|
|
"$out"/bin/comfyui --help
|
|
export XDG_DATA_HOME="$(mktemp -d)"
|
|
"$out"/bin/comfyui --cpu --quick-test-for-ci
|
|
|
|
runHook postInstallCheck
|
|
'';
|
|
|
|
passthru = {
|
|
inherit python pythonEnv;
|
|
}
|
|
// lib.optionalAttrs (!withManager) {
|
|
tests.withManager = callPackage ./package.nix {
|
|
withManager = true;
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
description = "Modular diffusion model GUI, API, and backend with graph and nodes interface (CUDA-enabled)";
|
|
homepage = "https://github.com/Comfy-Org/ComfyUI";
|
|
changelog = "https://github.com/Comfy-Org/ComfyUI/releases/tag/v${finalAttrs.version}";
|
|
license = lib.licenses.gpl3Only;
|
|
mainProgram = "comfyui";
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
})
|