mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-08-08 04:44:39 -05:00
83 lines
1.5 KiB
Nix
Executable file
83 lines
1.5 KiB
Nix
Executable file
{
|
|
config,
|
|
pkgs,
|
|
flake,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (flake.config.machines.devices) ceres;
|
|
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 {
|
|
stateDirs = [
|
|
"custom_nodes"
|
|
];
|
|
|
|
extensions = [
|
|
];
|
|
|
|
commandLineArgs = [
|
|
"--preview-method"
|
|
"auto"
|
|
];
|
|
};
|
|
};
|
|
caddy = {
|
|
virtualHosts = {
|
|
"${host}" = {
|
|
extraConfig = ''
|
|
basicauth {
|
|
{$CADDY_AUTH_USER} {$CADDY_AUTH_PASSWORD_HASH}
|
|
}
|
|
|
|
reverse_proxy ${localhost}:${toString service.ports.port0}
|
|
|
|
tls ${service.ssl.cert} ${service.ssl.key}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
fileSystems."/var/lib/${service.name}/models" = {
|
|
device = "${service.paths.path0}/models";
|
|
fsType = "none";
|
|
options = [
|
|
"bind"
|
|
];
|
|
depends = [
|
|
ceres.storage0.mount
|
|
];
|
|
};
|
|
systemd.tmpfiles.rules = [
|
|
"Z ${service.paths.path0}/models 755 root root -"
|
|
"Z ${service.sops.path0} 755 caddy caddy -"
|
|
];
|
|
|
|
users.users.${service.name}.extraGroups = [
|
|
"users"
|
|
"caddy"
|
|
];
|
|
|
|
networking = {
|
|
firewall = {
|
|
allowedTCPPorts = [
|
|
service.ports.port0
|
|
];
|
|
};
|
|
};
|
|
}
|