comfyui mostly done
This commit is contained in:
parent
ca53366fd0
commit
58243274cd
23 changed files with 1148 additions and 114 deletions
21
flakes/ComfyUI-Plugins/essentials/default.nix
Normal file
21
flakes/ComfyUI-Plugins/essentials/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
pkgs,
|
||||
src,
|
||||
python3Packages,
|
||||
...
|
||||
}: let
|
||||
inherit (python3Packages) numba colour-science rembg pixeloe transparent-background;
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "comfyui-essentials";
|
||||
version = "dev-${builtins.toString src.lastModified}";
|
||||
src = src;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
numba
|
||||
colour-science
|
||||
rembg
|
||||
pixeloe
|
||||
transparent-background
|
||||
];
|
||||
}
|
92
flakes/ComfyUI-Plugins/flake.lock
generated
Normal file
92
flakes/ComfyUI-Plugins/flake.lock
generated
Normal file
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
"nodes": {
|
||||
"essentials": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1728478639,
|
||||
"narHash": "sha256-JFkrtxLXx9wyJ5ZUlnXX+U5NGh5agiz0VOHQ5SA6jTs=",
|
||||
"owner": "cubiq",
|
||||
"repo": "ComfyUI_essentials",
|
||||
"rev": "f320ada61353c14e9d506592e20397398be6b952",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cubiq",
|
||||
"repo": "ComfyUI_essentials",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gguf": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1728958305,
|
||||
"narHash": "sha256-XJwWx9gm1Qo/B4t7olPajJlPqKJvciTRpB+9fyf8aXQ=",
|
||||
"owner": "city96",
|
||||
"repo": "ComfyUI-GGUF",
|
||||
"rev": "68ad5fb2149ead7e4978f83f14e045ecd812a394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "city96",
|
||||
"repo": "ComfyUI-GGUF",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1728888510,
|
||||
"narHash": "sha256-nsNdSldaAyu6PE3YUA+YQLqUDJh+gRbBooMMekZJwvI=",
|
||||
"path": "/nix/store/xnjw9gmfmpppdj6bxpw6cfkspc3h6xwl-source",
|
||||
"rev": "a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"openpose": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1685841563,
|
||||
"narHash": "sha256-GUjs8mIUFAbjJEVL+EsT44HG42mAiumKOBlBas1xxrM=",
|
||||
"owner": "space-nuko",
|
||||
"repo": "ComfyUI-OpenPose-Editor",
|
||||
"rev": "4d8fe730acdb11ab2fcd592129d91d338d270adf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "space-nuko",
|
||||
"repo": "ComfyUI-OpenPose-Editor",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"essentials": "essentials",
|
||||
"gguf": "gguf",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"openpose": "openpose",
|
||||
"tensorrt": "tensorrt"
|
||||
}
|
||||
},
|
||||
"tensorrt": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1728519788,
|
||||
"narHash": "sha256-tqiodF60IVlmvJknYxEwL0U7GIrrfl49k6Tg+8jGRVU=",
|
||||
"owner": "comfyanonymous",
|
||||
"repo": "ComfyUI_TensorRT",
|
||||
"rev": "5bcc3f1e5c2424bb20bcb586e340c25ebe4a954f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "comfyanonymous",
|
||||
"repo": "ComfyUI_TensorRT",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
48
flakes/ComfyUI-Plugins/flake.nix
Normal file
48
flakes/ComfyUI-Plugins/flake.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
inputs = {
|
||||
gguf = {
|
||||
url = "github:city96/ComfyUI-GGUF";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
tensorrt = {
|
||||
url = "github:comfyanonymous/ComfyUI_TensorRT";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# needs some deps packaged
|
||||
# essentials = {
|
||||
# url = "github:cubiq/ComfyUI_essentials";
|
||||
# flake = false;
|
||||
# };
|
||||
|
||||
openpose = {
|
||||
url = "github:space-nuko/ComfyUI-OpenPose-Editor";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
inherit (pkgs) lib callPackage;
|
||||
inherit (builtins) mapAttrs;
|
||||
filteredInputs = lib.filterAttrs (n: v: n != "nixpkgs") self.inputs;
|
||||
in {
|
||||
overlays.comfyui-plugins = final: prev: {
|
||||
comfyui-plugins =
|
||||
mapAttrs
|
||||
(name: value: final.callPackage ./${name}/default.nix {src = value;})
|
||||
filteredInputs;
|
||||
};
|
||||
packages.x86_64-linux =
|
||||
mapAttrs
|
||||
(name: value: callPackage ./${name}/default.nix {src = value;})
|
||||
filteredInputs;
|
||||
};
|
||||
}
|
21
flakes/ComfyUI-Plugins/gguf/default.nix
Normal file
21
flakes/ComfyUI-Plugins/gguf/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
pkgs,
|
||||
src,
|
||||
python3Packages,
|
||||
...
|
||||
}: let
|
||||
inherit (python3Packages) gguf numpy;
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "comfyui-gguf";
|
||||
version = "dev-${builtins.toString src.lastModified}";
|
||||
src = src;
|
||||
propagatedBuildInputs = [
|
||||
gguf
|
||||
numpy
|
||||
];
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
'';
|
||||
}
|
19
flakes/ComfyUI-Plugins/openpose/default.nix
Normal file
19
flakes/ComfyUI-Plugins/openpose/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
pkgs,
|
||||
src,
|
||||
...
|
||||
}:
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "comfyui-openpose-editor";
|
||||
version = "dev-${builtins.toString src.lastModified}";
|
||||
inherit src;
|
||||
|
||||
patches = [
|
||||
./openpose_no_update.patch
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
'';
|
||||
}
|
12
flakes/ComfyUI-Plugins/openpose/openpose_no_update.patch
Normal file
12
flakes/ComfyUI-Plugins/openpose/openpose_no_update.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/__init__.py b/__init__.py
|
||||
index e4cf8bb..7d8f894 100644
|
||||
--- a/__init__.py
|
||||
+++ b/__init__.py
|
||||
@@ -35,6 +35,6 @@ def update_javascript():
|
||||
shutil.copy(src_file, dst_file)
|
||||
|
||||
|
||||
-update_javascript()
|
||||
+# update_javascript()
|
||||
|
||||
print('\033[34mOpenPose Editor: \033[92mLoaded\033[0m')
|
23
flakes/ComfyUI-Plugins/tensorrt/default.nix
Normal file
23
flakes/ComfyUI-Plugins/tensorrt/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
pkgs,
|
||||
src,
|
||||
python3Packages,
|
||||
...
|
||||
}: let
|
||||
inherit (python3Packages) tensorrt onnx;
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "comfyui-tensorrt";
|
||||
version = "dev-${builtins.toString src.lastModified}";
|
||||
src = src;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
tensorrt
|
||||
onnx
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r * $out
|
||||
'';
|
||||
}
|
72
flakes/ComfyUI/default.nix
Normal file
72
flakes/ComfyUI/default.nix
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
comfyui,
|
||||
comfy_dir ? "/run/user/1000/comfyui/",
|
||||
spandrel,
|
||||
plugins ? config.comfyui.plugins,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs) python3;
|
||||
python = python3.withPackages (
|
||||
ps:
|
||||
with ps; [
|
||||
torch
|
||||
torchsde
|
||||
torchvision
|
||||
torchaudio
|
||||
einops
|
||||
transformers
|
||||
tokenizers
|
||||
sentencepiece
|
||||
safetensors
|
||||
aiohttp
|
||||
pyyaml
|
||||
pillow
|
||||
scipy
|
||||
tqdm
|
||||
psutil
|
||||
kornia
|
||||
soundfile
|
||||
|
||||
spandrel
|
||||
] ++ plugins
|
||||
);
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "comfyui";
|
||||
pname = "comfyui";
|
||||
version = "dev-${builtins.toString comfyui.lastModified}";
|
||||
src = comfyui;
|
||||
nativeBuildInputs = let
|
||||
inherit (pkgs) makeWrapper;
|
||||
in [
|
||||
makeWrapper
|
||||
];
|
||||
propagatedBuildInputs = let
|
||||
inherit (pkgs.cudaPackages) cudatoolkit;
|
||||
in [
|
||||
python
|
||||
cudatoolkit
|
||||
];
|
||||
|
||||
patches = [./folder_paths.patch];
|
||||
|
||||
installPhase = let
|
||||
launcher =
|
||||
pkgs.writeShellScript "launch.sh"
|
||||
''
|
||||
mkdir -p $COMFY_DIR/custom_nodes
|
||||
mkdir -p $COMFY_DIR/models/{checkpoints,configs,loras,vae,clip,unet,diffusion_models,clip_vision,style_models,embeddings,diffusers,vae_approx,controlnet,gligen,upscale_models,hypernetworks,photomaker,classifiers}
|
||||
${python}/bin/python3 $COMFY/comfyui/main.py --output-directory $(mktemp)
|
||||
'';
|
||||
in ''
|
||||
mkdir -p $out/comfyui
|
||||
cp -r * $out/comfyui
|
||||
mkdir -p $out/bin
|
||||
makeWrapper ${launcher} $out/bin/comfyui --prefix PATH : ${lib.makeBinPath [python]} \
|
||||
--set PYTHONPATH ${lib.makeLibraryPath [python]} --set COMFY $out --set COMFY_DIR ${comfy_dir}
|
||||
'';
|
||||
meta.mainProgram = "comfyui";
|
||||
}
|
41
flakes/ComfyUI/flake.lock
generated
Normal file
41
flakes/ComfyUI/flake.lock
generated
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"nodes": {
|
||||
"comfyui": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1729105110,
|
||||
"narHash": "sha256-M/by34k6P4Sj/dfsW1FdVRZmaTHxZ0mMX/cuYXIPeaw=",
|
||||
"owner": "comfyanonymous",
|
||||
"repo": "ComfyUI",
|
||||
"rev": "7390ff3b1ec2e15017ba4a52d6eaabc4aa4636e3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "comfyanonymous",
|
||||
"repo": "ComfyUI",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1728492678,
|
||||
"narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=",
|
||||
"path": "/nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source",
|
||||
"rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"comfyui": "comfyui",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
48
flakes/ComfyUI/flake.nix
Normal file
48
flakes/ComfyUI/flake.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
inputs = {
|
||||
comfyui = {
|
||||
url = "github:comfyanonymous/ComfyUI";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = ["https://nix-community.cachix.org" "https://cuda-maintainers.cachix.org"];
|
||||
extra-trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
|
||||
];
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
comfyui,
|
||||
}: {
|
||||
homeManagerModules.comfyui = import ./module.nix;
|
||||
|
||||
overlays.comfyui = final: _prev: {
|
||||
comfyui = let
|
||||
spandrel = final.callPackage ./spandrel.nix {};
|
||||
in
|
||||
final.callPackage ./default.nix {
|
||||
cudaSupport = true;
|
||||
inherit comfyui spandrel;
|
||||
};
|
||||
};
|
||||
|
||||
packages.x86_64-linux = let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
config.allowUnfree = true;
|
||||
config.cudaSupport = true;
|
||||
inherit system;
|
||||
};
|
||||
spandrel = pkgs.callPackage ./spandrel.nix {};
|
||||
in {
|
||||
default = pkgs.callPackage ./default.nix {
|
||||
inherit comfyui spandrel;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
28
flakes/ComfyUI/folder_paths.patch
Normal file
28
flakes/ComfyUI/folder_paths.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
diff --git a/folder_paths.py b/folder_paths.py
|
||||
index 01ae821..27906ac 100644
|
||||
--- a/folder_paths.py
|
||||
+++ b/folder_paths.py
|
||||
@@ -11,7 +11,7 @@ supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.bin', '.pth', '.safetenso
|
||||
|
||||
folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {}
|
||||
|
||||
-base_path = os.path.dirname(os.path.realpath(__file__))
|
||||
+base_path = os.path.dirname(os.environ['COMFY_DIR'])
|
||||
models_dir = os.path.join(base_path, "models")
|
||||
folder_names_and_paths["checkpoints"] = ([os.path.join(models_dir, "checkpoints")], supported_pt_extensions)
|
||||
folder_names_and_paths["configs"] = ([os.path.join(models_dir, "configs")], [".yaml"])
|
||||
@@ -39,10 +39,10 @@ folder_names_and_paths["photomaker"] = ([os.path.join(models_dir, "photomaker")]
|
||||
|
||||
folder_names_and_paths["classifiers"] = ([os.path.join(models_dir, "classifiers")], {""})
|
||||
|
||||
-output_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output")
|
||||
-temp_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp")
|
||||
-input_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input")
|
||||
-user_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "user")
|
||||
+output_directory = os.path.join(base_path, "output")
|
||||
+temp_directory = os.path.join(base_path, "temp")
|
||||
+input_directory = os.path.join(base_path, "input")
|
||||
+user_directory = os.path.join(base_path, "user")
|
||||
|
||||
filename_list_cache: dict[str, tuple[list[str], dict[str, float], float]] = {}
|
||||
|
44
flakes/ComfyUI/module.nix
Normal file
44
flakes/ComfyUI/module.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types hasSuffix;
|
||||
cfg = config.programs.comfyui;
|
||||
# comfyui only understands the path properly with a trailing slash
|
||||
getStorage =
|
||||
if (hasSuffix "/" cfg.storage)
|
||||
then cfg.storage
|
||||
else cfg.storage + "/";
|
||||
in {
|
||||
options.programs.comfyui = {
|
||||
enable = mkEnableOption "ComfyUI";
|
||||
storage = mkOption {
|
||||
type = types.path;
|
||||
description = "where to source models and store information";
|
||||
};
|
||||
plugins = mkOption {
|
||||
type = with types; listOf package;
|
||||
description = "list of comfyui plugins";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [
|
||||
(pkgs.comfyui.override {
|
||||
comfy_dir = getStorage;
|
||||
plugins = cfg.plugins;
|
||||
})
|
||||
];
|
||||
home.file = builtins.listToAttrs (map (
|
||||
pkg: {
|
||||
name = "${getStorage}/custom_nodes/${pkg.name}";
|
||||
value = {
|
||||
recursive = true;
|
||||
source = "${pkg}";
|
||||
};
|
||||
}
|
||||
)
|
||||
cfg.plugins);
|
||||
};
|
||||
}
|
43
flakes/ComfyUI/spandrel.nix
Normal file
43
flakes/ComfyUI/spandrel.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
lib,
|
||||
python3Packages,
|
||||
fetchPypi,
|
||||
...
|
||||
}:
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "spandrel";
|
||||
version = "0.4.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-9FUmiT+SOhLvN1QsROREsSCJdlk7x8zfpU/QTHw+gMo=";
|
||||
};
|
||||
|
||||
build-system = let
|
||||
inherit (python3Packages) setuptools;
|
||||
in [
|
||||
setuptools
|
||||
];
|
||||
|
||||
dependencies = let
|
||||
inherit
|
||||
(python3Packages)
|
||||
torch
|
||||
torchvision
|
||||
safetensors
|
||||
numpy
|
||||
einops
|
||||
typing-extensions
|
||||
;
|
||||
in [
|
||||
torch
|
||||
torchvision
|
||||
safetensors
|
||||
numpy
|
||||
einops
|
||||
typing-extensions
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue