From 47ca41fbb206e63b68f70b6d38261102e9e7d921 Mon Sep 17 00:00:00 2001 From: rogueking Date: Mon, 9 Feb 2026 10:10:56 -0800 Subject: [PATCH] working comfyui --- flake.lock | 89 ++++++++++++++++++++++++++++---- flake.nix | 5 +- hosts/ender-ml/configuration.nix | 23 +++++++-- 3 files changed, 103 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index 366c1a0..4c160a4 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,24 @@ { "nodes": { + "comfyui-nix": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1769471529, + "narHash": "sha256-OZkmTh5JLw+FJYb+d9PmNeX08q3HW9cZK42hqWBcwKs=", + "owner": "utensils", + "repo": "comfyui-nix", + "rev": "83d1b91eefc7c50cc8c70d37f770a8b7cfce4a3b", + "type": "github" + }, + "original": { + "owner": "utensils", + "repo": "comfyui-nix", + "type": "github" + } + }, "flake-compat": { "locked": { "lastModified": 1733328505, @@ -18,6 +37,24 @@ "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, + "locked": { + "lastModified": 1767609335, + "narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "250481aafeb741edfe23d29195671c19b36b6dca", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, "locked": { "lastModified": 1760948891, "narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=", @@ -32,7 +69,7 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -118,8 +155,8 @@ "nix-snapd": { "inputs": { "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs" + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1761703712, @@ -153,20 +190,36 @@ }, "nixpkgs": { "locked": { - "lastModified": 1761442529, - "narHash": "sha256-8aDps5fCt0Ndw56ZgeBvdT7E5zeUSFi3CJaNR7ZJKnA=", - "owner": "nixos", + "lastModified": 1766902085, + "narHash": "sha256-coBu0ONtFzlwwVBzmjacUQwj3G+lybcZ1oeNSQkgC0M=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "75762615e96b1a7f172dcdadf62aa9f3aebedf7b", + "rev": "c0b0e0fddf73fd517c3471e546c0df87a42d53f4", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-lib": { + "locked": { + "lastModified": 1765674936, + "narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_2": { "locked": { "lastModified": 1754788789, "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", @@ -198,6 +251,21 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1761442529, + "narHash": "sha256-8aDps5fCt0Ndw56ZgeBvdT7E5zeUSFi3CJaNR7ZJKnA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "75762615e96b1a7f172dcdadf62aa9f3aebedf7b", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1769318308, "narHash": "sha256-Mjx6p96Pkefks3+aA+72lu1xVehb6mv2yTUUqmSet6Q=", @@ -215,7 +283,7 @@ }, "nixvim": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "nixpkgs": [ "nixpkgs-unstable" ], @@ -237,12 +305,13 @@ }, "root": { "inputs": { + "comfyui-nix": "comfyui-nix", "home-manager": "home-manager", "home-manager-unstable": "home-manager-unstable", "nix-darwin": "nix-darwin", "nix-snapd": "nix-snapd", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim" } diff --git a/flake.nix b/flake.nix index ec63681..e22dd8e 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ nix-darwin.url = "github:nix-darwin/nix-darwin/master"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs-unstable"; nix-snapd.url = "github:nix-community/nix-snapd"; + comfyui-nix.url = "github:utensils/comfyui-nix"; #nix-snapd.inputs.pkgs-unstable.follows = "nixpkgs"; home-manager = { @@ -32,6 +33,7 @@ outputs = { self, + comfyui-nix, home-manager, home-manager-unstable, nix-darwin, @@ -39,7 +41,7 @@ nixos-hardware, nixpkgs, nixpkgs-unstable, - nixvim, + nixvim, ... }@inputs: let @@ -104,6 +106,7 @@ modules = [ ./hosts/ender-ml/configuration.nix inputs.home-manager.nixosModules.default + comfyui-nix.nixosModules.default ]; }; diff --git a/hosts/ender-ml/configuration.nix b/hosts/ender-ml/configuration.nix index 02a5760..a59ca3f 100644 --- a/hosts/ender-ml/configuration.nix +++ b/hosts/ender-ml/configuration.nix @@ -135,13 +135,29 @@ openssl ]; - # Enable ollama + # Enable ollama services.ollama = { enable = true; host = "0.0.0.0"; openFirewall = true; acceleration = "cuda"; - package = pkgs-unstable.ollama; + package = pkgs-unstable.ollama-cuda; + environmentVariables = { + CUDA_VISIBLE_DEVICES = "0,1"; + }; + }; + + services.comfyui = { + enable = true; + cuda = true; + enableManager = true; + listenAddress = "0.0.0.0"; + dataDir = "/home/rogueking/models/comfyui-data"; + user = "rogueking"; + group = "users"; + #createUser = true; # Use existing user + # If dataDir is on a separate mount (NFS, ZFS dataset, etc.): + # requiresMounts = [ "home-myuser-comfyui\\x2ddata.mount" ]; }; #services.llama-cpp = { @@ -200,7 +216,7 @@ # $ nix search wget environment.systemPackages = with pkgs; [ # Server-specific packages - btop + btop-cuda curl docker dust @@ -222,6 +238,7 @@ unzip vim + pkgs-unstable.stable-diffusion-cpp-cuda pkgs-unstable.llama-cpp pkgs-unstable.witr ];