From 9328ca3717f616796ce9d4d4dfd7d9aa9de7654b Mon Sep 17 00:00:00 2001 From: "matthew.binning" Date: Mon, 16 Feb 2026 07:15:15 -0800 Subject: [PATCH] feat: Add comfy-ui with basic auth --- flake.lock | 79 +++++++++++++++++++++++++++++++++++--- flake.nix | 11 ++++-- hosts/crossbox/comfyui.nix | 9 +++++ hosts/crossbox/default.nix | 1 + hosts/crossbox/nginx.nix | 17 ++++++++ 5 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 hosts/crossbox/comfyui.nix diff --git a/flake.lock b/flake.lock index 7b4da1a..6de247f 100644 --- a/flake.lock +++ b/flake.lock @@ -5,7 +5,7 @@ "flake-schemas": "flake-schemas", "home-manager": "home-manager", "jovian": "jovian", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "rust-overlay": "rust-overlay" }, "locked": { @@ -23,6 +23,25 @@ "type": "github" } }, + "comfyui-nix": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1770501766, + "narHash": "sha256-GWAsk06uDuLoKpvEcEP7h3PdWLhdJCxHM7C96s9X7UA=", + "owner": "utensils", + "repo": "comfyui-nix", + "rev": "dc0e4a2efc036092a98bb20503f827247f36f49a", + "type": "github" + }, + "original": { + "owner": "utensils", + "repo": "comfyui-nix", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -60,6 +79,24 @@ "type": "github" } }, + "flake-parts": { + "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-schemas": { "locked": { "lastModified": 1721999734, @@ -179,6 +216,37 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1766902085, + "narHash": "sha256-coBu0ONtFzlwwVBzmjacUQwj3G+lybcZ1oeNSQkgC0M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c0b0e0fddf73fd517c3471e546c0df87a42d53f4", + "type": "github" + }, + "original": { + "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_2": { "locked": { "lastModified": 1770562336, "narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=", @@ -194,7 +262,7 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1754725699, "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", @@ -210,7 +278,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1754725699, "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", @@ -244,7 +312,8 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs", + "comfyui-nix": "comfyui-nix", + "nixpkgs": "nixpkgs_2", "strix-halo": "strix-halo" } }, @@ -277,7 +346,7 @@ "ec-su-axb35": "ec-su-axb35", "flake-utils": "flake-utils", "llama-cpp": "llama-cpp", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "rocwmma": "rocwmma" }, "locked": { diff --git a/flake.nix b/flake.nix index 2f675bc..0e4a036 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,10 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; strix-halo.url = "github:hellas-ai/nix-strix-halo"; strix-halo.inputs.llama-cpp.url = "github:ggerganov/llama.cpp/b7984"; + comfyui-nix.url = "github:utensils/comfyui-nix"; }; - outputs = { self, nixpkgs, strix-halo, ... }: + outputs = { self, nixpkgs, strix-halo, comfyui-nix, ... }: let mkHost = { hostDir, extraModules ? [], overlays ? [], extraSpecialArgs ? {} }: nixpkgs.lib.nixosSystem { @@ -22,8 +23,12 @@ in { nixosConfigurations.crossbox = mkHost { hostDir = ./hosts/crossbox; - overlays = [ strix-halo.overlays.default ]; - extraModules = [ ./sdr.nix ./syncthing.nix ]; + overlays = [ strix-halo.overlays.default comfyui-nix.overlays.default ]; + extraModules = [ + ./sdr.nix + ./syncthing.nix + comfyui-nix.nixosModules.default + ]; extraSpecialArgs = { strix-halo-pkgs = strix-halo.packages.x86_64-linux; }; diff --git a/hosts/crossbox/comfyui.nix b/hosts/crossbox/comfyui.nix new file mode 100644 index 0000000..22fb2ca --- /dev/null +++ b/hosts/crossbox/comfyui.nix @@ -0,0 +1,9 @@ +{ config, pkgs, lib, ... }: + +{ + services.comfyui = { + enable = true; + listenAddress = "127.0.0.1"; + port = 8188; + }; +} diff --git a/hosts/crossbox/default.nix b/hosts/crossbox/default.nix index 0dd69b4..56beb8b 100644 --- a/hosts/crossbox/default.nix +++ b/hosts/crossbox/default.nix @@ -15,6 +15,7 @@ in ./forgejo.nix ./radicale.nix ./ollama.nix + ./comfyui.nix #./rustdesk.nix # ./llama-server.nix # disabled: source build broken (LLVM 22 vs 19 mismatch in strix-halo overlay) # ./docuseal.nix diff --git a/hosts/crossbox/nginx.nix b/hosts/crossbox/nginx.nix index efc76a2..2218292 100644 --- a/hosts/crossbox/nginx.nix +++ b/hosts/crossbox/nginx.nix @@ -207,6 +207,23 @@ in }; }; + # ComfyUI with HTTP basic authentication + "comfyui.binning.net" = { + forceSSL = true; + + sslCertificate = "/srv/nginx/binning.net.pem"; + sslCertificateKey = "/srv/nginx/binning.net.key.pem"; + + locations."/" = { + proxyPass = "http://127.0.0.1:8188"; + proxyWebsockets = true; + extraConfig = '' + auth_basic "ComfyUI"; + auth_basic_user_file "/srv/nginx/.htpasswd"; + ''; + }; + }; + # RustDesk "rustdesk.binning.net" = { forceSSL = true;