{ description = "ComfyUI"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; comfyui-src = { url = "github:comfyanonymous/ComfyUI"; flake = false; }; comfyui-mgr = { url = "github:ltdrdata/ComfyUI-Manager"; flake = false; }; }; # cuda # micromamba # pytorch # triton # comfyui # requirements.txt # needs some kind of mutability escape hatch for addons, models etc.. outputs = { self, nixpkgs, flake-utils, comfyui-src, comfyui-mgr, }: flake-utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs {inherit system;}; in with pkgs; rec { packages.default = buildFHSEnv { name = "ComfyUI"; targetPkgs = pkgs: (with pkgs; with cudaPackages; [ cuda_cudart cudnn micromamba ]); extraBuildCommands = '' mkdir -p $out/opt/ComfyUI mkdir -p $out/opt/ComfyUI/custom_nodes/ComfyUI-Manager cp -R ${comfyui-src}/* $out/opt/ComfyUI cp -R ${comfyui-mgr}/* $out/opt/ComfyUI/custom_nodes/ComfyUI-Manager ''; profile = '' ln -nfs /opt/ComfyUI/models /host/etc/comfyui/models ln -nfs /opt/ComfyUI/custom_nodes /host/etc/comfyui/custom_nodes ''; # cd /opt/ComfyUI # eval "$(micromamba shell hook --shell bash)" # micromamba activate # micromamba install python pytorch triton # pip install -r requirements.txt # ''; runScript = '' bash # ./startup.sh ''; }; } ); }