AUTOMATIC1111/stable-diffusion-webui for CUDA and ROCm on NixOS
Go to file
Jari Vetoniemi a2e79fcaf7
feat: add CPU and Apple Silicon support
On Apple silicon, the CPU path is still hardware accelerated.
2023-11-21 05:39:36 +08:00
.gitignore feat: add CPU and Apple Silicon support 2023-11-21 05:39:36 +08:00
flake.lock feat: initial functionality 2022-12-31 18:04:07 +08:00
flake.nix feat: add CPU and Apple Silicon support 2023-11-21 05:39:36 +08:00
impl.nix feat: add CPU and Apple Silicon support 2023-11-21 05:39:36 +08:00
LICENSE chore: add LICENSE 2022-12-31 18:09:05 +08:00
README.md feat: add CPU and Apple Silicon support 2023-11-21 05:39:36 +08:00
shell.nix feat: add CPU and Apple Silicon support 2023-11-21 05:39:36 +08:00

AUTOMATIC1111/stable-diffusion-webui for CUDA and ROCm on NixOS

This is literally just a shell.nix/flake.nix for stable-diffusion-webui that also enables CUDA/ROCm on NixOS. This supports NVIDIA GPUs (using CUDA), AMD GPUs (using ROCm), and CPU compute (including Apple silicon).

Usage

Setup

git clone https://github.com/virchau13/automatic1111-webui-nix
cd automatic1111-webui-nix
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

Flakes

nix develop # CPU or Apple silicon
nix develop .#cuda # CUDA
nix develop .#rocm # ROCm

Non-flakes

nix-shell # CPU
nix-shell --argstr variant CUDA # CUDA
nix-shell --argstr variant ROCM # ROCm

Launching webui

cd automatic1111-webui-nix
./webui.sh
# follow the tutorials at the original project for setting up Stable Diffusion / GFPGAN / whatever

You might want to switch to high performance mode on battery-powered devices.

Is this completely pure?

This is just a Nix shell for bootstrapping the web UI, not an actual pure flake; the ./webui.sh will still install a bunch of Python packages (into a venv, so not polluting your system) when you run it.

Troubleshooting

xformers

Run ./webui.sh --xformers to set up xformers. If this command fails, try git pulling from the source repository, then deleting the venv (rm -r venv) and reinstalling everything from scratch again (sometimes the venv will keep old packages around forever even if they should be updated.)

Credits