comfyui, comfyui-manager: init at 0.20.1 / 4.2.1#515744
Conversation
|
FYI there is another ComfyUI init PR at #441841 |
|
Thanks for pointing that out. I missed #441841 when opening this and called it out in the PR body. My read: #441841 has valuable prior work on runtime ergonomics, custom-node packaging, ComfyUI-GGUF, and the broader module/security story. This PR is narrower and more current: ComfyUI 0.20.1, current dependency pins, local build/smoke/update-script validation, and nixpkgs-review-gha. I borrowed the low-risk package ergonomics from #441841, especially writable XDG runtime defaults and an in-package help smoke test, while leaving custom nodes / NixOS module work for follow-up or coordination with @06kellyjac. |
fcd1f46 to
cb2a394
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Add the `comfyui-manager` Python package and wire it into the comfyui runtime environment so `comfyui --enable-manager` resolves the prestartup hook without requiring out-of-band `pip install`.
Address review request from drupol: each new Python module that ships no runnable test suite under sandbox (or none at all) should set `doCheck = false` with a one-line justification. - comfy-aimdo: upstream ships no tests at this tag. - comfy-kitchen: upstream tests need CUDA/Triton; build is BUILD_NO_CUDA. - comfyui-embedded-docs: only static Markdown docs. - comfyui-frontend-package: only the prebuilt frontend bundle. - comfyui-workflow-templates*: only static workflow JSON assets. - comfyui-workflow-templates-core: tests rely on the source monorepo layout and cannot run from the published sdist.
|
06kellyjac
left a comment
There was a problem hiding this comment.
Makes sense to do the nixos module part later.
I mostly did the all-in-one PR as the module was my plan for using and testing comfyui.
Raised some comments
| pythonEnv = python3.withPackages ( | ||
| ps: with ps; [ | ||
| aiohttp | ||
| alembic | ||
| av | ||
| blake3 | ||
| comfy-aimdo | ||
| comfy-kitchen | ||
| comfyui-embedded-docs | ||
| comfyui-frontend-package | ||
| comfyui-manager | ||
| comfyui-workflow-templates | ||
| einops | ||
| filelock | ||
| glfw | ||
| kornia | ||
| numpy | ||
| pillow | ||
| psutil | ||
| pydantic | ||
| pydantic-settings | ||
| pyopengl | ||
| pyyaml | ||
| requests | ||
| safetensors | ||
| scipy | ||
| sentencepiece | ||
| simpleeval | ||
| spandrel | ||
| sqlalchemy | ||
| tokenizers | ||
| torch | ||
| torchaudio | ||
| torchsde | ||
| torchvision | ||
| tqdm | ||
| transformers | ||
| yarl | ||
| ] | ||
| ); | ||
| in | ||
| stdenvNoCC.mkDerivation (finalAttrs: { |
There was a problem hiding this comment.
Can this be adapted to python3Packages.buildPythonApplication
My linked PR should be helpful reference
There was a problem hiding this comment.
Done in a0ba005. comfyui now uses python3Packages.buildPythonApplication with pyproject = false; I kept the explicit binary wrapper and disabled the automatic Python wrapper pass with dontWrapPythonPrograms = true because this package already wraps the selected Python env around main.py.
| substituteInPlace comfy/cli_args.py \ | ||
| --replace-fail \ | ||
| 'parser.add_argument("--base-directory", type=str, default=None, help="Set the ComfyUI base directory for models, custom_nodes, input, output, temp, and user directories.")' \ | ||
| 'xdg_data_home = os.environ.get("XDG_DATA_HOME") or os.path.expanduser("~/.local/share") | ||
| comfyui_data_home = os.path.join(xdg_data_home, "comfyui") | ||
| parser.add_argument("--base-directory", type=str, default=comfyui_data_home, help="Set the ComfyUI base directory for models, custom_nodes, input, output, temp, and user directories.")' \ | ||
| --replace-fail \ | ||
| 'database_default_path = os.path.abspath( | ||
| os.path.join(os.path.dirname(__file__), "..", "user", "comfyui.db") | ||
| )' \ | ||
| 'database_default_path = os.path.join(comfyui_data_home, "user", "comfyui.db")' | ||
|
|
||
| substituteInPlace folder_paths.py \ | ||
| --replace-fail \ | ||
| 'folder_names_and_paths["custom_nodes"] = ([os.path.join(base_path, "custom_nodes")], set())' \ | ||
| 'custom_nodes_directory = os.path.join(base_path, "custom_nodes") | ||
| folder_names_and_paths["custom_nodes"] = ([custom_nodes_directory], set())' \ | ||
| --replace-fail \ | ||
| 'if not os.path.exists(input_directory): | ||
| try: | ||
| os.makedirs(input_directory) | ||
| except: | ||
| logging.error("Failed to create input directory")' \ | ||
| 'for default_directory in (input_directory, custom_nodes_directory): | ||
| if not os.path.exists(default_directory): | ||
| try: | ||
| os.makedirs(default_directory) | ||
| except: | ||
| logging.error(f"Failed to create {default_directory}")' |
There was a problem hiding this comment.
These replaces seem too large and brittle and should probably be a local .patch file
There was a problem hiding this comment.
Done in a0ba005. I moved the large runtime-path substitutions into pkgs/by-name/co/comfyui/use-writable-runtime-paths.patch, leaving package.nix with a normal patches = [ ./use-writable-runtime-paths.patch ]; entry.
|
Thanks, addressed the requested ComfyUI packaging changes in a0ba005:
Local validation passed with |
| comfy-kitchen | ||
| comfyui-embedded-docs | ||
| comfyui-frontend-package | ||
| comfyui-manager |
There was a problem hiding this comment.
IMO there should be a version without manager.
I manage comfy plugins via nix and don't want the extra code that could grab any other arbitrary project.
withManager ? false (or inverted)
There was a problem hiding this comment.
Done in 469943f. comfyui now defaults to the Manager-free build and users can opt in with comfyui.override { withManager = true; }. I also added comfyui.tests.withManager so the Manager-enabled variant stays covered, and verified the default closure has no comfyui-manager path.
|
Adds ComfyUI 0.20.1 (a modular diffusion model GUI/API/backend with a graph and nodes interface) and ComfyUI-Manager 4.2.1, plus the Comfy-specific Python helpers required by both.
comfyuibuilds without ComfyUI-Manager by default, so the base package stays suitable for Nix-managed custom nodes and does not include Manager's arbitrary project fetching surface. Users who want Manager can opt in with:The Manager-enabled variant is also covered by
comfyui.tests.withManager.Related: #441841 is an earlier draft ComfyUI init by @06kellyjac with useful work around writable runtime paths, custom-node packaging, ComfyUI-GGUF, ComfyUI-Manager caveats, and CUDA/ROCm ergonomics. This PR is a narrower current-version package init; it intentionally leaves the NixOS module and custom-node ecosystem as follow-up/coordination work rather than duplicating that larger scope.
comfy-kitchenis built in its source-supported no-CUDA variant; GPU support for ComfyUI comes from the selectedtorchpackage set.Upstream patch
ComfyUI-Manager's prestartup hook unconditionally calls
pip/uvto "self-heal" the Python env (PIPFixer auto-rollback, the unified dependency resolver, per-nodepip install -r requirements.txt). On Nix that is a read-only store, so--enable-managerstartup still emits a noisyerror: The interpreter [...] is externally managedchain before Manager continues loading.I sent an opt-out switch upstream so distros can disable the auto-install paths without forking: Comfy-Org/ComfyUI-Manager#2851. Once that lands and ships in a release, this package can set
dependency_management = off(or exportCOMFYUI_MANAGER_DEPENDENCY_MANAGEMENT=off) to make--enable-managerclean by default. Until then, users opting in to the manager will see the install errors but Manager itself still loads.Local validation
nix fmt pkgs/by-name/co/comfyui/package.nixnix build -L --impure --expr 'let pkgs = import ./. {}; in pkgs.comfyui'nix build -L --impure --expr 'let pkgs = import ./. {}; in pkgs.comfyui.override { withManager = true; }'nix build -L --impure --expr 'let pkgs = import ./. {}; in pkgs.comfyui.tests.withManager'nix path-info -r /nix/store/yp9dhkvf84kmzjsym08qpqzssrnqpvd2-comfyui-0.20.1 | rg 'comfyui-manager' || trueproduced no output for the default build closure.nix eval --impure --expr 'let pkgs = import ./. {}; in pkgs.comfyui.passthru.tests.withManager.pname + "-" + pkgs.comfyui.passthru.tests.withManager.version'nix eval --impure --expr 'let pkgs = import ./. { config.allowUnfree = true; }; in pkgs.comfyui.updateScript'nix-shell maintainers/scripts/update.nix --argstr package comfyui --argstr skip-prompt truenixpkgs-review-ghais running for the current PR head: https://github.com/caniko/nixpkgs-review-gha/actions/runs/25518071431Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.