Skip to content

Commit

Permalink
stable-diffusion-webui: setup
Browse files Browse the repository at this point in the history
  • Loading branch information
xddxdd committed Nov 26, 2024
1 parent 791d360 commit ee2c075
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
6 changes: 6 additions & 0 deletions dns/domains/xuyh0120.win.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ let
target = "hetzner-de";
ttl = "1h";
}
{
recordType = "CNAME";
name = "stable-diffusion";
target = "lt-home-vm.ltnet.xuyh0120.win.";
ttl = "1h";
}
{
recordType = "CNAME";
name = "stats";
Expand Down
3 changes: 1 addition & 2 deletions helpers/constants.nix
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ rec {
Pterodactyl.Redis = 13679;
Pterodactyl.Wings = 13680;
Vaultwarden = 13772;
GoAutoconfig.Start = 13780;
GoAutoconfig.Stop = 13789;
StableDiffusionWebUI = 13786;
Plausible = 13800;
Netbox = 13801;
Attic = 13803;
Expand Down
1 change: 1 addition & 0 deletions hosts/lt-home-vm/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
../../nixos/optional-apps/pterodactyl-panel.nix
../../nixos/optional-apps/pterodactyl-wings.nix
../../nixos/optional-apps/sftp-server.nix
../../nixos/optional-apps/stable-diffusion-webui.nix
../../nixos/optional-apps/syncthing.nix
../../nixos/optional-apps/tachidesk.nix
../../nixos/optional-apps/uni-api.nix
Expand Down
51 changes: 51 additions & 0 deletions nixos/optional-apps/stable-diffusion-webui.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
LT,
...
}:
let
subfolders = [
# Data folders
"inputs"
"textual_inversion_templates"
"embeddings"
"extensions"
"models"
"localizations"
"outputs"
# Cache across container runs
"venv"
"repositories"
];
in
{
virtualisation.oci-containers.containers.stable-diffusion = {
extraOptions = [
"--pull"
"always"
"--gpus"
"all"
];
image = "universonic/stable-diffusion-webui";
ports = [ "127.0.0.1:${LT.portStr.StableDiffusionWebUI}:8080" ];
volumes = builtins.map (
f: "/var/lib/stable-diffusion/${f}:/app/stable-diffusion-webui/${f}"
) subfolders;
};

# Container uses UID/GID 1000
systemd.tmpfiles.rules = builtins.map (
f: "d /var/lib/stable-diffusion/${f} 755 1000 1000"
) subfolders;

lantian.nginxVhosts = {
"stable-diffusion.xuyh0120.win" = {
locations."/" = {
proxyPass = "http://127.0.0.1:${LT.portStr.StableDiffusionWebUI}";
proxyWebsockets = true;
};

sslCertificate = "xuyh0120.win_ecc";
noIndex.enable = true;
};
};
}

0 comments on commit ee2c075

Please sign in to comment.