feat: added comfyui to caddy

This commit is contained in:
Nick 2025-07-27 17:52:29 -05:00
parent d443dc5953
commit 67537dc549
4 changed files with 56 additions and 41 deletions

View file

@ -4,54 +4,59 @@
flake,
...
}:
let
inherit (flake.config.machines.devices)
ceres
;
inherit (flake.config.services.instances)
comfyui
web
;
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
];
services.comfyui = {
enable = true;
openFirewall = true;
host = localhost;
package = pkgs.comfyuiPackages.comfyui.override {
extensions = with pkgs.comfyuiPackages.extensions; [
acly-inpaint
acly-tooling
cubiq-ipadapter-plus
fannovel16-controlnet-aux
];
commandLineArgs = [
"--preview-method"
"auto"
];
services = {
comfyui = {
enable = true;
openFirewall = true;
host = localhost;
package = pkgs.comfyuiPackages.comfyui.override {
extensions = with pkgs.comfyuiPackages.extensions; [
acly-inpaint
acly-tooling
cubiq-ipadapter-plus
fannovel16-controlnet-aux
];
commandLineArgs = [
"--preview-method"
"auto"
];
};
};
caddy = {
environmentFile = config.sops.secrets."caddy/${service.name}-auth".path;
virtualHosts = {
"${host}" = {
extraConfig = ''
basicauth {
{$CADDY_AUTH_USER} {$CADDY_AUTH_PASSWORD_HASH}
}
root * ${service.paths.path0}
file_server
encode gzip
try_files {path} /index.html
tls ${service.ssl.cert} ${service.ssl.key}
'';
};
};
};
};
# fileSystems."/var/lib/${service.name}" = {
# device = service.paths.path0;
# fsType = "none";
# options = [
# "bind"
# ];
# depends = [
# ceres.storage0.mount
# ];
# };
# systemd.tmpfiles.rules = [
# "Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
# "Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
# ];
systemd.tmpfiles.rules = [
"Z ${service.sops.path0} 755 caddy caddy -"
];
users.users.${service.name}.extraGroups = [
"users"