Skip to content

Commit 6e5ae42

Browse files
jamesbrinkclaude
andauthored
Update ComfyUI to v0.7.0 with PyTorch optimizations (#16)
* feat: Update ComfyUI to v0.7.0 with latest dependencies - ComfyUI: 0.6.0 → 0.7.0 (released 2025-12-31) - Frontend package: 1.34.9 → 1.37.1 - Manager: 4.0.2 → 4.0.4 - Workflow templates: 0.7.59 → 0.7.65 - Workflow templates core: 0.3.43 → 0.3.65 - Workflow templates media API: 0.3.22 → 0.3.34 - Workflow templates media video: 0.3.19 → 0.3.22 - Workflow templates media image: 0.3.36 → 0.3.47 - Workflow templates media other: 0.3.47 → 0.3.63 - KJNodes: 2025-12-21 → 2025-12-28 - WanVideoWrapper: 2025-12-24 → 2025-12-31 * fix: Add ultralytics and improve ComfyUI-Manager package handling - Add ultralytics for Impact Subpack's UltralyticsDetectorProvider node - Create PEP 405 compliant venv structure for mutable package installs - Add version constraints to prevent Manager from overriding vendored packages - Set UV_CONSTRAINT alongside PIP_CONSTRAINT for uv compatibility * fix: Update to latest nixpkgs and fix compatibility issues - Update nixpkgs from April 2025 to December 2025 - Migrate from legacy darwin.apple_sdk.frameworks.Metal to apple-sdk_14 - Disable failing imageio test_process_termination (exit code 6 vs 2) * fix: Increase file descriptor limit for aiohttp/grpc DNS resolver The nixpkgs update brought aiohttp 3.13.2 which uses grpc/c-ares for async DNS resolution. This consumes significantly more file descriptors per connection. Combined with ComfyUI-Manager's concurrent HTTP requests during startup, this exhausts the default macOS limit of 256 FDs. Add ulimit -n 10240 to the launcher to prevent "Too many open files" errors on both macOS and Linux. * fix: Filter Rust build artifacts from Cachix push Skip Cargo.lock, Cargo.toml, and .cargo-checksum.json files when pushing build dependencies. These intermediate files cause upload retries and aren't useful for cache consumers who pull pre-built packages. * fix: Add allowUnsupportedSystem for nixpkgs badPlatforms workaround Work around nixpkgs-unstable issues where certain packages are marked in meta.badPlatforms even though they work: - cudnn 9.13.0 for CUDA 12.8 on x86_64-linux - kornia-rs on aarch64-linux Added allowUnsupportedSystem = true to: - mkCudaPkgs helper (CUDA builds) - pkgsLinuxX86 (x86_64 Docker images) - pkgsLinuxArm64 (aarch64 Docker images) See: NixOS/nixpkgs#458799 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Disable cuda_compat on x86_64-linux to fix CUDA build cuda_compat is only available for aarch64-linux (Jetson devices) but was incorrectly being pulled into the dependency tree on x86_64-linux builds. This adds an overlay to set cuda_compat = null on x86_64-linux systems, preventing the build failure "variable $src or $srcs should point to source". Combined with allowUnsupportedSystem for the cudnn badPlatforms workaround, CUDA builds now work correctly on x86_64-linux. See: NixOS/nixpkgs#458799 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: Use pre-built PyTorch CUDA wheels to avoid OOM during builds Switch from compiling PyTorch from source to using pre-built wheels from pytorch.org for CUDA builds. This provides: - Fast builds (~2GB download vs hours of compilation) - Low memory usage (no 30-60GB RAM requirement) - All GPU architectures (Pascal through Hopper) in one package - CUDA 12.4 runtime bundled in wheels Also removes architecture-specific packages (cuda-sm61, etc.) since the wheel-based approach supports all architectures universally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Use PyTorch 2.5.1 on macOS to fix MPS crash on macOS 26 PyTorch 2.9.x in nixpkgs has MPS bugs on macOS 26 (Tahoe) that cause trace trap crashes during SDXL inference. Pin to 2.5.1 pre-built wheels from pytorch.org for macOS Apple Silicon. - Add darwinArm64 wheel pins in nix/versions.nix - Add macOS-specific torch/torchvision/torchaudio overrides - Exclude kornia on macOS (Cargo build issues unrelated to torch) Fixes: pytorch/pytorch#167679 * fix: Address PR review feedback - Use exact version pinning (==) for vendored packages instead of >= - Add comment explaining kornia exclusion on macOS with issue reference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Exclude kornia on aarch64-linux due to badPlatforms - kornia-rs has aarch64-linux in badPlatforms, causing CI failures - Also improve Cachix filter regex to be more defensive 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Remove obsolete cudaArch/cudaCapabilities from NixOS module The wheel-based CUDA approach supports all GPU architectures in a single package, so architecture-specific options are no longer needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b3baf8a commit 6e5ae42

File tree

11 files changed

+755
-687
lines changed

11 files changed

+755
-687
lines changed

CLAUDE.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
99
## Build/Run Commands
1010
- **Run application**: `nix run` (default)
1111
- **Run with browser**: `nix run -- --open` (automatically opens browser)
12-
- **Run with CUDA**: `nix run .#cuda` (Linux/NVIDIA only, uses Nix-provided CUDA PyTorch)
12+
- **Run with CUDA**: `nix run .#cuda` (Linux/NVIDIA only, uses pre-built PyTorch CUDA wheels)
1313
- **Run with custom port**: `nix run -- --port=8080` (specify custom port)
1414
- **Run with network access**: `nix run -- --listen 0.0.0.0` (allow external connections)
1515
- **Run with debug logging**: `nix run -- --debug` or `nix run -- --verbose`
@@ -30,13 +30,13 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
3030
- **Dev shell**: `nix develop` provides ruff and pyright for manual linting/type-checking
3131

3232
## Version Management
33-
- Current ComfyUI version: v0.6.0 (pinned in `nix/versions.nix`)
33+
- Current ComfyUI version: v0.7.0 (pinned in `nix/versions.nix`)
3434
- To update ComfyUI: modify `version`, `rev`, and `hash` in `nix/versions.nix`
3535
- Frontend/docs/template packages: vendored wheels pinned in `nix/versions.nix`
3636
- Template input files: auto-generated in `nix/template-inputs.nix`
3737
- Update with: `./scripts/update-template-inputs.sh && git add nix/template-inputs.nix`
3838
- Python version: 3.12 (stable for ML workloads)
39-
- PyTorch: Stable releases (no nightly builds), provided by Nix
39+
- PyTorch: CPU builds use nixpkgs; CUDA builds use pre-built wheels from pytorch.org
4040

4141
## Project Architecture
4242

@@ -85,8 +85,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
8585
- `DYLD_LIBRARY_PATH`: (macOS) Set automatically to include dynamic libraries
8686

8787
### Platform-Specific Configuration
88-
- Uses Nix-provided PyTorch packages (no runtime detection or installs)
89-
- CUDA support via `nix run .#cuda` (Linux/NVIDIA only)
88+
- CPU builds use Nix-provided PyTorch packages (no runtime detection or installs)
89+
- CUDA support via `nix run .#cuda` (Linux/NVIDIA only):
90+
- Uses pre-built PyTorch wheels from pytorch.org (fast builds, ~2GB download)
91+
- Supports all GPU architectures (Pascal through Hopper) in a single build
92+
- CUDA 12.4 runtime bundled in wheels (no separate toolkit needed)
9093
- Library Paths: Automatically includes `/run/opengl-driver/lib` on Linux for NVIDIA drivers
9194

9295
### Data Persistence Structure

README.md

Lines changed: 28 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,11 @@ nix run github:utensils/comfyui-nix -- --open
1818

1919
For CUDA (Linux/NVIDIA):
2020

21-
> **⚠️ Important:** CUDA builds compile PyTorch, triton, and other large packages from source, which can take **multiple hours** and requires significant RAM. **[Set up the binary cache](#binary-cache) first** to download pre-built binaries instead.
22-
2321
```bash
24-
# RTX GPUs (2000/3000/4000 series) - default
2522
nix run github:utensils/comfyui-nix#cuda
26-
27-
# GTX 1080/1070/1060 (Pascal)
28-
nix run github:utensils/comfyui-nix#cuda-sm61
29-
30-
# Data center GPUs (H100)
31-
nix run github:utensils/comfyui-nix#cuda-sm90
3223
```
3324

34-
See [CUDA GPU Support](#cuda-gpu-support) for all available architectures.
25+
CUDA builds use pre-built PyTorch wheels from pytorch.org, so builds are fast (~2GB download) and support all GPU architectures from Pascal (GTX 1080) through Hopper (H100) in a single package.
3526

3627
## Options
3728

@@ -56,46 +47,18 @@ All [ComfyUI CLI options] are supported. Common examples:
5647

5748
## CUDA GPU Support
5849

59-
CUDA builds are available for Linux with NVIDIA GPUs. The default `#cuda` includes all GPU architectures for maximum compatibility and cache sharing with Docker images. For optimized builds targeting your specific GPU, use architecture-specific packages.
60-
61-
> **📦 Before running any CUDA package:** [Set up the binary cache](#binary-cache) to avoid hours of compilation.
62-
63-
### Available Architectures
50+
CUDA builds are available for Linux with NVIDIA GPUs. The `#cuda` package uses pre-built PyTorch wheels from pytorch.org which:
6451

65-
| Package | SM | GPU Generation | Example GPUs |
66-
| ------------ | --- | -------------- | ------------------------ |
67-
| `#cuda` | All | All GPUs | Works on any NVIDIA GPU |
68-
| `#cuda-sm61` | 6.1 | Pascal | GTX 1080, 1070, 1060 |
69-
| `#cuda-sm75` | 7.5 | Turing | RTX 2080, 2070, GTX 1660 |
70-
| `#cuda-sm86` | 8.6 | Ampere | RTX 3080, 3090, A10, A40 |
71-
| `#cuda-sm89` | 8.9 | Ada Lovelace | RTX 4090, 4080, L4, L40s |
72-
| `#cuda-sm70` | 7.0 | Volta | V100 (data center) |
73-
| `#cuda-sm80` | 8.0 | Ampere DC | A100 (data center) |
74-
| `#cuda-sm90` | 9.0 | Hopper | H100 (data center) |
75-
76-
### Usage
52+
- **Fast builds**: Downloads ~2GB of pre-built wheels instead of compiling for hours
53+
- **Low memory**: No 30-60GB RAM requirement for compilation
54+
- **All architectures**: Supports Pascal (GTX 1080) through Hopper (H100) in one package
55+
- **Bundled runtime**: CUDA 12.4 libraries included in wheels (no separate toolkit needed)
7756

7857
```bash
79-
# All GPUs (default - works everywhere, best cache hits)
8058
nix run github:utensils/comfyui-nix#cuda
81-
82-
# GTX 1080 (Pascal architecture)
83-
nix run github:utensils/comfyui-nix#cuda-sm61
84-
85-
# A100 data center GPU
86-
nix run github:utensils/comfyui-nix#cuda-sm80
87-
88-
# H100 data center GPU
89-
nix run github:utensils/comfyui-nix#cuda-sm90
9059
```
9160

92-
### Why Architecture-Specific Builds?
93-
94-
- **Faster builds**: Building for one architecture is much faster than all architectures
95-
- **Better cache hits**: Pre-built packages for each architecture in the binary cache
96-
- **Smaller closures**: Only the kernels you need are included
97-
98-
The [cuda-maintainers cache](https://github.com/SomeoneSerge/nixpkgs-cuda-ci) builds for common architectures. Using matching architecture-specific packages maximizes cache hits and minimizes build time.
61+
This single package works on any NVIDIA GPU from the past ~8 years.
9962

10063
## Why a Nix Flake?
10164

@@ -292,17 +255,10 @@ Add ComfyUI as a package in your system configuration:
292255

293256
The overlay provides these packages:
294257

295-
| Package | Description |
296-
| ------------------------ | -------------------------------------------------- |
297-
| `pkgs.comfy-ui` | CPU + Apple Silicon (Metal) - use this for macOS |
298-
| `pkgs.comfy-ui-cuda` | All NVIDIA GPU architectures (Linux only) |
299-
| `pkgs.comfy-ui-cuda-sm61`| Pascal (GTX 1080, 1070, 1060) |
300-
| `pkgs.comfy-ui-cuda-sm70`| Volta (V100) |
301-
| `pkgs.comfy-ui-cuda-sm75`| Turing (RTX 2080, 2070, GTX 1660) |
302-
| `pkgs.comfy-ui-cuda-sm80`| Ampere DC (A100) |
303-
| `pkgs.comfy-ui-cuda-sm86`| Ampere (RTX 3080, 3090) |
304-
| `pkgs.comfy-ui-cuda-sm89`| Ada Lovelace (RTX 4090, 4080) |
305-
| `pkgs.comfy-ui-cuda-sm90`| Hopper (H100) |
258+
| Package | Description |
259+
| -------------------- | ------------------------------------------------ |
260+
| `pkgs.comfy-ui` | CPU + Apple Silicon (Metal) - use this for macOS |
261+
| `pkgs.comfy-ui-cuda` | NVIDIA GPUs (Linux only, all architectures) |
306262

307263
> **Note:** On macOS with Apple Silicon, the base `comfy-ui` package automatically uses Metal for GPU acceleration. No separate CUDA package is needed.
308264
@@ -343,50 +299,22 @@ nix profile add github:utensils/comfyui-nix#cuda
343299

344300
### Module Options
345301

346-
| Option | Default | Description |
347-
| ------------------ | -------------------- | ------------------------------------------------------------------------------ |
348-
| `enable` | `false` | Enable the ComfyUI service |
349-
| `cuda` | `false` | Enable NVIDIA GPU acceleration (targets RTX by default) |
350-
| `cudaArch` | `null` | Pre-built architecture: `sm61`, `sm70`, `sm75`, `sm80`, `sm86`, `sm89`, `sm90` |
351-
| `cudaCapabilities` | `null` | Custom CUDA capabilities list (triggers source build) |
352-
| `enableManager` | `false` | Enable the built-in ComfyUI Manager |
353-
| `port` | `8188` | Port for the web interface |
354-
| `listenAddress` | `"127.0.0.1"` | Listen address (`"0.0.0.0"` for network access) |
355-
| `dataDir` | `"/var/lib/comfyui"` | Data directory for models, outputs, custom nodes |
356-
| `user` | `"comfyui"` | User account to run ComfyUI under |
357-
| `group` | `"comfyui"` | Group to run ComfyUI under |
358-
| `createUser` | `true` | Create the comfyui system user/group |
359-
| `openFirewall` | `false` | Open the port in the firewall |
360-
| `extraArgs` | `[]` | Additional CLI arguments |
361-
| `environment` | `{}` | Environment variables for the service |
362-
| `customNodes` | `{}` | Declarative custom nodes (see below) |
363-
| `requiresMounts` | `[]` | Mount units to wait for before starting |
364-
365-
### GPU Architecture Selection
366-
367-
The module provides three ways to configure CUDA support:
368-
369-
```nix
370-
# Option 1: Default build (all GPU architectures)
371-
services.comfyui = {
372-
enable = true;
373-
cuda = true;
374-
};
375-
376-
# Option 2: Pre-built architecture-specific package (fast, cached)
377-
services.comfyui = {
378-
enable = true;
379-
cudaArch = "sm61"; # GTX 1080
380-
};
381-
382-
# Option 3: Custom capabilities (compiles from source)
383-
services.comfyui = {
384-
enable = true;
385-
cudaCapabilities = [ "6.1" "8.6" ]; # Pascal + Ampere
386-
};
387-
```
388-
389-
Priority order: `cudaCapabilities` > `cudaArch` > `cuda` > CPU
302+
| Option | Default | Description |
303+
| --------------- | -------------------- | ------------------------------------------------ |
304+
| `enable` | `false` | Enable the ComfyUI service |
305+
| `cuda` | `false` | Enable NVIDIA GPU acceleration |
306+
| `enableManager` | `false` | Enable the built-in ComfyUI Manager |
307+
| `port` | `8188` | Port for the web interface |
308+
| `listenAddress` | `"127.0.0.1"` | Listen address (`"0.0.0.0"` for network access) |
309+
| `dataDir` | `"/var/lib/comfyui"` | Data directory for models, outputs, custom nodes |
310+
| `user` | `"comfyui"` | User account to run ComfyUI under |
311+
| `group` | `"comfyui"` | Group to run ComfyUI under |
312+
| `createUser` | `true` | Create the comfyui system user/group |
313+
| `openFirewall` | `false` | Open the port in the firewall |
314+
| `extraArgs` | `[]` | Additional CLI arguments |
315+
| `environment` | `{}` | Environment variables for the service |
316+
| `customNodes` | `{}` | Declarative custom nodes (see below) |
317+
| `requiresMounts`| `[]` | Mount units to wait for before starting |
390318

391319
**Note:** When `dataDir` is under `/home/`, `ProtectHome` is automatically disabled to allow access.
392320

@@ -490,22 +418,6 @@ nix flake check # Run all checks (build, lint, type-check, nixfmt)
490418
nix run .#update # Check for ComfyUI updates
491419
```
492420

493-
### Building CUDA Packages from Source
494-
495-
CUDA builds (PyTorch, magma, triton, bitsandbytes) are memory-intensive. If you're building from source and experience OOM kills, limit parallelism:
496-
497-
```bash
498-
# Recommended for 32-64GB RAM
499-
nix build .#cuda --max-jobs 2 --cores 12
500-
501-
# Conservative for 16-32GB RAM
502-
nix build .#cuda --max-jobs 1 --cores 8
503-
504-
# Minimal for <16GB RAM (slow but safe)
505-
nix build .#cuda --max-jobs 1 --cores 4
506-
```
507-
508-
Use the [binary cache](#binary-cache) when possible to avoid building CUDA packages entirely.
509421

510422
## Data Structure
511423

@@ -524,7 +436,7 @@ ComfyUI runs from the Nix store; only user data lives in your data directory.
524436

525437
## Binary Cache
526438

527-
> **⚠️ Highly recommended for CUDA users:** Without the binary cache, CUDA builds compile PyTorch, magma, triton, bitsandbytes, and other CUDA packages from source. This can take **multiple hours** and requires significant RAM (32GB+ recommended). With the cache, you download pre-built binaries in minutes.
439+
The binary cache speeds up builds by downloading pre-built packages instead of compiling from source.
528440

529441
**Quick setup (recommended):**
530442

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)