dotfiles/modules/nixos/services/comfyui/default.nix

57 lines
1 KiB
Nix
Raw Normal View History

2025-07-18 14:57:37 -05:00
{
2025-07-18 16:56:51 -05:00
config,
pkgs,
2025-07-18 18:58:51 -05:00
flake,
2025-07-18 16:23:38 -05:00
...
}:
2025-07-18 16:25:10 -05:00
let
2025-07-18 20:53:49 -05:00
inherit (flake.config.machines.devices) ceres;
inherit (flake.config.services.instances) comfyui web;
2025-07-18 18:58:51 -05:00
inherit (flake.config.people) user0;
2025-07-18 20:53:49 -05:00
service = comfyui;
localhost = web.localhost.address1;
2025-07-18 16:25:10 -05:00
in
2025-07-18 16:23:38 -05:00
{
2025-07-18 20:53:49 -05:00
services.comfyui = {
enable = true;
2025-07-18 21:27:04 -05:00
package = pkgs.comfyui-nvidia;
2025-07-18 20:53:49 -05:00
host = localhost;
2025-07-18 21:27:04 -05:00
user = service.name;
acceleration = "cuda";
models = builtins.attrValues {
inherit (pkgs.nixified-ai)
models
;
};
customNodes = builtins.attrValues {
inherit (comfyui.pkgs)
comfyui-gguf
comfyui-impact-pack
;
};
2025-07-18 20:53:49 -05:00
};
fileSystems."/var/lib/${service.name}" = {
device = service.paths.path0;
fsType = "none";
options = [
"bind"
];
depends = [
ceres.storage0.mount
];
2025-07-18 16:56:51 -05:00
};
2025-07-18 20:53:49 -05:00
systemd.tmpfiles.rules = [
2025-07-18 21:27:04 -05:00
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
2025-07-18 20:53:49 -05:00
];
2025-07-18 16:56:51 -05:00
2025-07-18 20:53:49 -05:00
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
];
2025-07-18 16:56:51 -05:00
};
};
2025-07-18 14:57:37 -05:00
}