From 5b5c18e45f3b19253ed8c19106a14f4b97c345f3 Mon Sep 17 00:00:00 2001 From: Vir Chaudhury Date: Wed, 22 Nov 2023 05:31:13 +0800 Subject: [PATCH] docs: clarify README Make the CPU output non-default, so you must specifically choose which output you actually want. --- README.md | 17 +++++++++++------ flake.nix | 3 ++- impl.nix | 5 +++-- shell.nix | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 14b6516..8549b62 100644 --- a/README.md +++ b/README.md @@ -7,24 +7,29 @@ This supports NVIDIA GPUs (using CUDA), AMD GPUs (using ROCm), and CPU compute ( ### Setup +First, run: ```bash git clone https://github.com/virchau13/automatic1111-webui-nix -cd automatic1111-webui-nix git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui +cp automatic1111-webui-nix/*.nix stable-diffusion-webui/ +cd stable-diffusion-webui +git add *.nix ``` -### Flakes +After that, choose the command according to your platform: + +#### Flakes ```bash -nix develop # CPU or Apple silicon +nix develop .#cpu # CPU or Apple silicon nix develop .#cuda # CUDA nix develop .#rocm # ROCm ``` -### Non-flakes +#### Non-flakes ```bash -nix-shell # CPU +nix-shell --argstr variant CPU # CPU nix-shell --argstr variant CUDA # CUDA nix-shell --argstr variant ROCM # ROCm ``` @@ -52,5 +57,5 @@ Run `./webui.sh --xformers` to set up xformers. If this command fails, try git p ## Credits - AUTOMATIC1111 for obvious reasons. - rprospero for [ROCm support](https://github.com/virchau13/automatic1111-webui-nix/pull/3). -- Cloudef for [CPU compute / Apple Silicon support](https://github.com/virchau13/automatic1111-webui-nix/pull/10) +- Cloudef for [CPU compute / Apple Silicon support](https://github.com/virchau13/automatic1111-webui-nix/pull/10). - polypoyo for [the original draft of this](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/4736). diff --git a/flake.nix b/flake.nix index ee34e10..6bceb29 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,8 @@ config.allowUnfree = true; }; in { - devShells.default = import ./impl.nix { inherit pkgs; variant = "CPU"; }; + devShells.default = throw "You need to specify which output you want: CPU, ROCm, or CUDA."; + devShells.cpu = import ./impl.nix { inherit pkgs; variant = "CPU"; }; devShells.cuda = import ./impl.nix { inherit pkgs; variant = "CUDA"; }; devShells.rocm = import ./impl.nix { inherit pkgs; variant = "ROCM"; }; } diff --git a/impl.nix b/impl.nix index 7074a19..bc55055 100644 --- a/impl.nix +++ b/impl.nix @@ -1,4 +1,4 @@ -{ pkgs, variant ? "CUDA", ... }: +{ pkgs, variant, ... }: let hardware_deps = with pkgs; @@ -19,7 +19,8 @@ let ] else if variant == "ROCM" then [ rocmPackages.rocm-runtime pciutils - ] else []; + ] else if variant == "CPU" then [ + ] else throw "You need to specify which variant you want: CPU, ROCm, or CUDA."; in pkgs.mkShell rec { diff --git a/shell.nix b/shell.nix index 7afbe7f..f462e75 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ variant ? "CUDA" }: +{ variant ? "NONE" }: let pkgs = import { }; in import ./impl.nix { inherit pkgs variant; }