feat: testing comfy

This commit is contained in:
Nick 2025-08-03 22:19:54 -05:00
parent b3900949a8
commit a2cebf3117

View file

@ -68,45 +68,21 @@ in
allowedTCPPorts = [ cfg.port ]; allowedTCPPorts = [ cfg.port ];
}; };
systemd.services.comfyui = systemd.services.comfyui = {
let description = "ComfyUI Service";
comfyui-wrapper = pkgs.writeShellScript "comfyui-wrapper" '' wantedBy = [ "multi-user.target" ];
# Let ComfyUI initialize its files first after = [ "network.target" ];
cd /var/lib/comfyui
# Start ComfyUI in background to initialize files serviceConfig = {
${cfg.package}/bin/comfyui --port ${toString cfg.port} --listen ${cfg.host} & Type = "simple";
COMFYUI_PID=$! ExecStart = "${cfg.package}/bin/comfyui --port ${toString cfg.port} --listen ${cfg.host}";
ExecStartPost = "${pkgs.bash}/bin/bash -c 'sleep 5 && mkdir -p /var/lib/comfyui/custom_nodes'";
# Wait a moment for file initialization Restart = "on-failure";
sleep 2 User = "comfyui";
Group = "comfyui";
# Kill the initialization process WorkingDirectory = "/var/lib/comfyui";
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";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "simple";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/lib/comfyui/custom_nodes";
ExecStart = "${comfyui-wrapper}";
Restart = "on-failure";
User = "comfyui";
Group = "comfyui";
WorkingDirectory = "/var/lib/comfyui";
};
}; };
};
users.users.comfyui = { users.users.comfyui = {
group = "comfyui"; group = "comfyui";