nixos-config/profiles/servers/stable-diffusion.nix
2023-01-26 02:30:17 +03:00

34 lines
1.0 KiB
Nix

{ config, lib, pkgs, ... }:
with config.virtualisation.oci-containers; {
virtualisation.oci-containers.containers.stable-diffusion = {
# autoStart = true;
autoStart = false;
cmd = [ "./init.sh" ];
# environment = {
# COMMANDLINE_ARGS = "--listen --port 7860 --deepdanbooru --medvram --opt-split-attention --disable-console-progressbars --enable-console-prompts";
# };
extraOptions = [
"--device=/dev/kfd"
"--device=/dev/dri"
"--group-add=video"
"--ipc=host"
"--cap-add=SYS_PTRACE"
"--security-opt"
"seccomp=unconfined"
"--hostname=stable-diffusion-ct"
];
image = "docker.io/ataraxiadev/rocm-pytorch";
ports = [ "80:7860/tcp" ];
volumes = [
"/home/${config.mainuser}/projects/stable-diffusion-rocm/shared:/shared"
];
};
systemd.services."${backend}-stable-diffusion" = {
preStop = lib.mkForce "${backend} stop -t 10 stable-diffusion";
serviceConfig.TimeoutStopSec = lib.mkForce 15;
};
networking.firewall.allowedTCPPorts = [ 7860 ];
}