diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3ed4c07 --- /dev/null +++ b/flake.lock @@ -0,0 +1,79 @@ +{ + "nodes": { + "comfyuigit": { + "flake": false, + "locked": { + "lastModified": 1755071198, + "narHash": "sha256-vIw22ISbjUnfRB6+TFE7QKbVnEXu6BFAN8lmCGE74/M=", + "owner": "comfyanonymous", + "repo": "ComfyUi", + "rev": "d5c1954d5cd4a789bbf84d2b75a955a5a3f93de8", + "type": "github" + }, + "original": { + "owner": "comfyanonymous", + "ref": "v0.3.50", + "repo": "ComfyUi", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1755186698, + "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "comfyuigit": "comfyuigit", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..69fc121 --- /dev/null +++ b/flake.nix @@ -0,0 +1,67 @@ +{ + description = "ComfyUI as a Nix Flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + comfyuigit = { + flake = false; + url = "github:comfyanonymous/ComfyUi/v0.3.50"; + }; + }; + + outputs = { comfyuigit, flake-utils, nixpkgs, ... }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { + inherit system; + }; + pyenv = pkgs.python312.buildEnv.override { + extraLibs = with pkgs.python312Packages; [ + torchvision + torchaudio + torchsde + + einops + transformers + safetensors + pyyaml + pillow + scipy + tqdm + psutil + kornia + numba + opencv4 + GitPython + numexpr + matplotlib + pandas + imageio-ffmpeg + scikit-image + pip + accelerate + ]; + }; + in rec { + packages = rec { + comfyui = pkgs.stdenv.mkDerivation { + name = "comfyui"; + src = comfyuigit; + installPhase = '' + mkdir -p $out/bin + cp -r $src/* $out + + echo "${pyenv}/bin/python main.py" > $out/bin/comfyui + chmod +x $out/bin/comfyui + ''; + }; + + default = comfyui; + }; + + devShell = pkgs.mkShell { + buildInputs = [packages.comfyuimain pyenv]; + }; + } + ); +}