feat: testing comfy

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

View file

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