1

Reenable stablediffusion container

This commit is contained in:
2023-05-25 22:54:57 +02:00
parent 7f21b51143
commit 5a29dc4fd8
4 changed files with 41 additions and 11 deletions

View File

@ -12,6 +12,7 @@
vols ? [], vols ? [],
env ? {}, env ? {},
opts ? [], opts ? [],
extraConfig ? {},
netns ? "", netns ? "",
netdns ? "", netdns ? "",
}: let }: let
@ -24,18 +25,19 @@
++ (lib.optionals (netdns != "") [ ++ (lib.optionals (netdns != "") [
"--dns=${netdns}" "--dns=${netdns}"
]); ]);
in { in
image = image; lib.mergeAttrs extraConfig {
autoStart = autoStart; image = image;
ports = ports ++ expanded-id-ports; autoStart = autoStart;
volumes = vols; ports = ports ++ expanded-id-ports;
environment = lib.mergeAttrs env { volumes = vols;
PUID = "1000"; environment = lib.mergeAttrs env {
PGID = "1000"; PUID = "1000";
TZ = "Europe/Berlin"; PGID = "1000";
TZ = "Europe/Berlin";
};
extraOptions = opts ++ additional-opts;
}; };
extraOptions = opts ++ additional-opts;
};
# Filter all system service attributes that the user units don't have and add some required attributes # Filter all system service attributes that the user units don't have and add some required attributes
# Example: podman-stablediffusion = mkOciUserService config.systemd.services.podman-stablediffusion; # Example: podman-stablediffusion = mkOciUserService config.systemd.services.podman-stablediffusion;

View File

@ -25,6 +25,30 @@ in {
]; ];
}); });
# Development
# NOTE: PyTorch ROCM image is 36 GB large...
# NOTE: This requires to setup the PodmanROCM direcory beforehand, as described here:
# https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-AMD-GPUs#running-inside-docker
# NOTE: This requires to manually link the launch.sh, since this is a system module (can't use home.file)
stablediffusion = mkIf cfg.stablediffusion.enable (mkOciContainer {
image = "rocm/pytorch:rocm5.5_ubuntu20.04_py3.8_pytorch_1.13.1";
vols = [
"/home/christoph/NoSync/StableDiffusionWebUI:/webui-data"
];
opts = [
"--network=host"
"--device=/dev/kfd"
"--device=/dev/dri"
"--group-add=video"
"--ipc=host"
"--cap-add=SYS_PTRACE"
"--security-opt=seccomp=unconfined"
];
extraConfig = {
entrypoint = "/webui-data/launch.sh";
};
});
# Multimedia # Multimedia
jellyfin = mkIf cfg.jellyfin.enable (mkOciContainer { jellyfin = mkIf cfg.jellyfin.enable (mkOciContainer {
image = "linuxserver/jellyfin:10.8.10"; image = "linuxserver/jellyfin:10.8.10";

View File

@ -14,6 +14,9 @@ with mylib.modules; {
homeassistant = { homeassistant = {
enable = mkEnableOpt "Enable HomeAssistant Container"; enable = mkEnableOpt "Enable HomeAssistant Container";
}; };
stablediffusion = {
enable = mkEnableOpt "Enable StableDiffusion Container with Automatic1111 WebUI";
};
jellyfin = { jellyfin = {
enable = mkEnableOpt "Enable Jellyfin Container"; enable = mkEnableOpt "Enable Jellyfin Container";
}; };

View File

@ -19,6 +19,7 @@
enable = true; enable = true;
homeassistant.enable = false; homeassistant.enable = false;
stablediffusion.enable = true;
jellyfin.enable = true; jellyfin.enable = true;
fileflows.enable = false; fileflows.enable = false;
sonarr.enable = true; sonarr.enable = true;