feat: testing comfy

This commit is contained in:
Nick 2025-08-03 22:17:03 -05:00
parent abc5f6dee4
commit b3900949a8

View file

@ -68,7 +68,31 @@ in
allowedTCPPorts = [ cfg.port ]; allowedTCPPorts = [ cfg.port ];
}; };
systemd.services.comfyui = { systemd.services.comfyui =
let
comfyui-wrapper = pkgs.writeShellScript "comfyui-wrapper" ''
# Let ComfyUI initialize its files first
cd /var/lib/comfyui
# Start ComfyUI in background to initialize files
${cfg.package}/bin/comfyui --port ${toString cfg.port} --listen ${cfg.host} &
COMFYUI_PID=$!
# Wait a moment for file initialization
sleep 2
# Kill the initialization process
kill $COMFYUI_PID 2>/dev/null || true
wait $COMFYUI_PID 2>/dev/null || true
# Now recreate the custom_nodes directory
mkdir -p /var/lib/comfyui/custom_nodes
# Start ComfyUI properly
exec ${cfg.package}/bin/comfyui --port ${toString cfg.port} --listen ${cfg.host}
'';
in
{
description = "ComfyUI Service"; description = "ComfyUI Service";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
@ -76,7 +100,7 @@ in
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/lib/comfyui/custom_nodes"; ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/lib/comfyui/custom_nodes";
ExecStart = "${cfg.package}/bin/comfyui --port ${toString cfg.port} --listen ${cfg.host}"; ExecStart = "${comfyui-wrapper}";
Restart = "on-failure"; Restart = "on-failure";
User = "comfyui"; User = "comfyui";
Group = "comfyui"; Group = "comfyui";