current
linted
This commit is contained in:
parent
4e99a0e323
commit
7485de646a
95 changed files with 2743 additions and 2282 deletions
|
@ -5,12 +5,12 @@
|
|||
comfyui,
|
||||
comfy_dir ? "/run/user/1000/comfyui/",
|
||||
spandrel,
|
||||
plugins ? config.comfyui.plugins or [],
|
||||
plugins ? config.comfyui.plugins or [ ],
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (pkgs) python3;
|
||||
inherit
|
||||
(pkgs.python3Packages)
|
||||
inherit (pkgs.python3Packages)
|
||||
torch
|
||||
torchsde
|
||||
torchvision
|
||||
|
@ -31,87 +31,66 @@
|
|||
;
|
||||
|
||||
python = python3.buildEnv.override {
|
||||
extraLibs =
|
||||
[
|
||||
torch
|
||||
torchsde
|
||||
torchvision
|
||||
torchaudio
|
||||
einops
|
||||
transformers
|
||||
tokenizers
|
||||
sentencepiece
|
||||
safetensors
|
||||
aiohttp
|
||||
pyyaml
|
||||
pillow
|
||||
scipy
|
||||
tqdm
|
||||
psutil
|
||||
kornia
|
||||
soundfile
|
||||
extraLibs = [
|
||||
torch
|
||||
torchsde
|
||||
torchvision
|
||||
torchaudio
|
||||
einops
|
||||
transformers
|
||||
tokenizers
|
||||
sentencepiece
|
||||
safetensors
|
||||
aiohttp
|
||||
pyyaml
|
||||
pillow
|
||||
scipy
|
||||
tqdm
|
||||
psutil
|
||||
kornia
|
||||
soundfile
|
||||
|
||||
spandrel
|
||||
]
|
||||
++ plugins;
|
||||
spandrel
|
||||
] ++ plugins;
|
||||
};
|
||||
# python = python3.withPackages (
|
||||
# ps:
|
||||
# with ps; [
|
||||
# torch
|
||||
# torchsde
|
||||
# torchvision
|
||||
# torchaudio
|
||||
# einops
|
||||
# transformers
|
||||
# tokenizers
|
||||
# sentencepiece
|
||||
# safetensors
|
||||
# aiohttp
|
||||
# pyyaml
|
||||
# pillow
|
||||
# scipy
|
||||
# tqdm
|
||||
# psutil
|
||||
# kornia
|
||||
# soundfile
|
||||
# spandrel
|
||||
# ]
|
||||
# );
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "comfyui";
|
||||
pname = "comfyui";
|
||||
version = "dev-${builtins.toString comfyui.lastModified}";
|
||||
src = comfyui;
|
||||
nativeBuildInputs = let
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "comfyui";
|
||||
pname = "comfyui";
|
||||
version = "dev-${builtins.toString comfyui.lastModified}";
|
||||
src = comfyui;
|
||||
nativeBuildInputs =
|
||||
let
|
||||
inherit (pkgs) makeWrapper;
|
||||
in [
|
||||
in
|
||||
[
|
||||
makeWrapper
|
||||
];
|
||||
propagatedBuildInputs = let
|
||||
propagatedBuildInputs =
|
||||
let
|
||||
inherit (pkgs.cudaPackages) cudatoolkit;
|
||||
in [
|
||||
in
|
||||
[
|
||||
python
|
||||
cudatoolkit
|
||||
];
|
||||
|
||||
patches = [./folder_paths.patch];
|
||||
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 ''
|
||||
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}
|
||||
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";
|
||||
}
|
||||
meta.mainProgram = "comfyui";
|
||||
}
|
||||
|
|
14
flakes/comfyui/flake.lock
generated
14
flakes/comfyui/flake.lock
generated
|
@ -3,11 +3,11 @@
|
|||
"comfyui": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1735863648,
|
||||
"narHash": "sha256-hMe8kXco8PTtOeLq0Q2+P3MbcnnShzAlOeCnY1MSuyI=",
|
||||
"lastModified": 1738409722,
|
||||
"narHash": "sha256-x9gVw07sPF6SSJE/idOYZVWbJDpDHGr+m77CPd0z+Ho=",
|
||||
"owner": "comfyanonymous",
|
||||
"repo": "ComfyUI",
|
||||
"rev": "0b9839ef433572609b37d880afb427e4c9ddf151",
|
||||
"rev": "9e1d301129db2507e6681a83d845186802e4ba22",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -18,10 +18,10 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1735471104,
|
||||
"narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=",
|
||||
"path": "/nix/store/8vz84mqgnm1gz5yk7hgnnb5gir5hjxas-source",
|
||||
"rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4",
|
||||
"lastModified": 1738410390,
|
||||
"narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=",
|
||||
"path": "/nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source",
|
||||
"rev": "3a228057f5b619feb3186e986dbe76278d707b6e",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -7,42 +7,49 @@
|
|||
};
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = ["https://nix-community.cachix.org" "https://cuda-maintainers.cachix.org"];
|
||||
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;
|
||||
outputs =
|
||||
{
|
||||
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;
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,15 +3,19 @@
|
|||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types hasSuffix;
|
||||
}:
|
||||
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 {
|
||||
getStorage = if (hasSuffix "/" cfg.storage) then cfg.storage else cfg.storage + "/";
|
||||
in
|
||||
{
|
||||
options.programs.comfyui = {
|
||||
enable = mkEnableOption "ComfyUI";
|
||||
storage = mkOption {
|
||||
|
@ -21,7 +25,7 @@ in {
|
|||
plugins = mkOption {
|
||||
type = with types; listOf package;
|
||||
description = "list of comfyui plugins";
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -29,18 +33,17 @@ in {
|
|||
# pkgs.comfyui
|
||||
(pkgs.comfyui.override {
|
||||
comfy_dir = getStorage;
|
||||
plugins = cfg.plugins;
|
||||
inherit (cfg) plugins;
|
||||
})
|
||||
];
|
||||
home.file = builtins.listToAttrs (map (
|
||||
pkg: {
|
||||
name = "${getStorage}/custom_nodes/${pkg.name}";
|
||||
value = {
|
||||
recursive = true;
|
||||
source = "${pkg}";
|
||||
};
|
||||
}
|
||||
)
|
||||
cfg.plugins);
|
||||
home.file = builtins.listToAttrs (
|
||||
map (pkg: {
|
||||
name = "${getStorage}/custom_nodes/${pkg.name}";
|
||||
value = {
|
||||
recursive = true;
|
||||
source = "${pkg}";
|
||||
};
|
||||
}) cfg.plugins
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
lib,
|
||||
python3Packages,
|
||||
fetchPypi,
|
||||
...
|
||||
|
@ -14,30 +13,33 @@ python3Packages.buildPythonPackage rec {
|
|||
hash = "sha256-9FUmiT+SOhLvN1QsROREsSCJdlk7x8zfpU/QTHw+gMo=";
|
||||
};
|
||||
|
||||
build-system = let
|
||||
inherit (python3Packages) setuptools;
|
||||
in [
|
||||
setuptools
|
||||
];
|
||||
build-system =
|
||||
let
|
||||
inherit (python3Packages) setuptools;
|
||||
in
|
||||
[
|
||||
setuptools
|
||||
];
|
||||
|
||||
dependencies = let
|
||||
inherit
|
||||
(python3Packages)
|
||||
dependencies =
|
||||
let
|
||||
inherit (python3Packages)
|
||||
torch
|
||||
torchvision
|
||||
safetensors
|
||||
numpy
|
||||
einops
|
||||
typing-extensions
|
||||
;
|
||||
in
|
||||
[
|
||||
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