dotfiles/systems/ceres/config/comfyui.nix

86 lines
1.8 KiB
Nix
Raw Normal View History

2025-07-19 19:06:11 -05:00
{
2025-07-27 21:53:49 -05:00
config,
pkgs,
flake,
...
}:
2025-07-27 17:52:29 -05:00
2025-07-27 21:53:49 -05:00
let
2025-07-29 16:42:30 -05:00
inherit (flake.config.machines.devices) ceres;
2025-07-27 21:53:49 -05:00
inherit (flake.config.services.instances) comfyui web;
service = comfyui;
localhost = web.localhost.address1;
host = service.domains.url0;
in
{
nixpkgs.overlays = [
flake.inputs.nix-comfyui.overlays.default
];
2025-07-19 19:11:24 -05:00
2025-07-27 21:53:49 -05:00
services = {
comfyui = {
enable = true;
openFirewall = true;
host = localhost;
2025-07-29 16:35:35 -05:00
package = pkgs.comfyuiPackages.comfyui.override {
extensions = with pkgs.comfyuiPackages.extensions; [
acly-inpaint
acly-tooling
kosinkadink-advanced-controlnet
kosinkadink-animatediff-evolved
kosinkadink-video-helper-suite
lev145-images-grid
ssitu-ultimate-sd-upscale
];
commandLineArgs = [
"--preview-method"
"auto"
];
};
2025-07-27 21:53:49 -05:00
};
caddy = {
virtualHosts = {
"${host}" = {
extraConfig = ''
basicauth {
{$CADDY_AUTH_USER} {$CADDY_AUTH_PASSWORD_HASH}
}
2025-07-27 18:07:10 -05:00
2025-07-27 21:53:49 -05:00
reverse_proxy ${localhost}:${toString service.ports.port0}
2025-07-27 18:07:10 -05:00
2025-07-27 21:53:49 -05:00
tls ${service.ssl.cert} ${service.ssl.key}
'';
};
};
};
};
2025-07-29 16:21:16 -05:00
2025-07-29 16:49:42 -05:00
# fileSystems."/var/lib/${service.name}" = {
# device = service.paths.path0;
# fsType = "none";
# options = [
# "bind"
# ];
# depends = [
# ceres.storage0.mount
# ];
# };
2025-07-27 21:53:49 -05:00
systemd.tmpfiles.rules = [
2025-07-29 16:49:42 -05:00
# "Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
2025-07-27 21:53:49 -05:00
"Z ${service.sops.path0} 755 caddy caddy -"
];
2025-07-19 19:11:24 -05:00
2025-07-27 21:53:49 -05:00
users.users.${service.name}.extraGroups = [
"users"
"caddy"
];
2025-07-19 19:11:24 -05:00
2025-07-27 21:53:49 -05:00
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
];
};
};
2025-07-19 19:06:11 -05:00
}