Skip to content

Commit 18138bf

Browse files
committed
feat: comfyui
1 parent 558c466 commit 18138bf

File tree

7 files changed

+232
-90
lines changed

7 files changed

+232
-90
lines changed

custom_modules/comfyui.nix

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
inputs,
6+
system,
7+
...
8+
}:
9+
let
10+
cfg = config.custom_modules.comfyui;
11+
in
12+
{
13+
options.custom_modules.comfyui.enable = lib.mkOption {
14+
description = "Enable comfy ui";
15+
type = lib.types.bool;
16+
default = true;
17+
18+
};
19+
config = lib.mkIf cfg.enable {
20+
services.comfyui = {
21+
enable = true;
22+
cuda = true;
23+
enableManager = true;
24+
port = 6188;
25+
listenAddress = "0.0.0.0";
26+
dataDir = "/var/lib/comfyui";
27+
openFirewall = true;
28+
# extraArgs = [ "--lowvram" ];
29+
# environment = { };
30+
};
31+
32+
};
33+
34+
}

custom_modules/core_services.nix

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ in
138138
reverse_proxy 127.0.0.1:7171
139139
}
140140
141+
handle_path /comfyui* {
142+
reverse_proxy 127.0.0.1:6188
143+
}
144+
141145
handle_path /caddy-api* {
142146
reverse_proxy 127.0.0.1:2019 {
143147
header_up Host {upstream_hostport}
@@ -216,6 +220,32 @@ in
216220
description = "Download from spotify";
217221
};
218222
}
223+
{
224+
"ComfyUI" = {
225+
icon = "comfyui";
226+
href = "/comfyui/";
227+
description = "Stable Diffusion GUI";
228+
widget = {
229+
type = "customapi";
230+
url = "http://127.0.0.1:6188/system_stats";
231+
refreshInterval = 5000;
232+
mappings = [
233+
{
234+
field = "system.system_free_memory";
235+
label = "Free RAM";
236+
format = "size";
237+
scale = 1;
238+
}
239+
{
240+
field = "devices.0.vram_free";
241+
label = "VRAM Free";
242+
format = "size";
243+
scale = 1;
244+
}
245+
];
246+
};
247+
};
248+
}
219249
];
220250
}
221251
{
@@ -704,16 +734,18 @@ in
704734
# cachix stuffs
705735
settings.substituters = [
706736
"https://cache.nixos.org"
707-
# "https://cuda-maintainers.cachix.org"
737+
"https://cuda-maintainers.cachix.org"
708738
"https://cachix.cachix.org"
709739
# "https://jrestivo.cachix.org"
710740
"http://nix-community.cachix.org/"
741+
"https://comfyui.cachix.org"
711742
];
712743
settings.trusted-public-keys = [
713744
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
714-
# "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
745+
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
715746
"cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM="
716747
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
748+
"comfyui.cachix.org-1:33mf9VzoIjzVbp0zwj+fT51HG0y31ZTK3nzYZAX0rec="
717749
];
718750
gc = {
719751
automatic = true;

0 commit comments

Comments
 (0)