Skip to content

Instantly share code, notes, and snippets.

@PerchunPak
Created May 31, 2024 15:41
Show Gist options
  • Save PerchunPak/0db295792b5d095859a29a7770d1f4d2 to your computer and use it in GitHub Desktop.
Save PerchunPak/0db295792b5d095859a29a7770d1f4d2 to your computer and use it in GitHub Desktop.
StableDiffusion A1111 on Nixos
# based on https://github.com/virchau13/automatic1111-webui-nix
# usage:
# - Clone and cd https://github.com/AUTOMATIC1111/stable-diffusion-webui
# - place this file into clonned repository
# - `nix-shell shell.nix`
let
pkgs = import <nixpkgs> { config.allowUnfree = true; };
variant = "CUDA";
in
pkgs.mkShell rec {
name = "stable-diffusion-webui";
buildInputs =
with pkgs;
[
git # The program instantly crashes if git is not present, even if everything is already downloaded
python311
stdenv.cc.cc.lib
stdenv.cc
ncurses5
binutils
gitRepo
gnupg
autoconf
curl
procps
gnumake
util-linux
m4
gperf
unzip
libGLU
libGL
glib
]
++ [
# other dependencies
# python311Packages.insightface
# python311Packages.protobuf
]
++ lib.lists.optionals (variant == "CUDA") [
cudatoolkit
linuxPackages.nvidia_x11
xorg.libXi
xorg.libXmu
freeglut
xorg.libXext
xorg.libX11
xorg.libXv
xorg.libXrandr
zlib
# for xformers
gcc
]
++ lib.lists.optionals (variant == "ROCM") [
rocmPackages.rocm-runtime
pciutils
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
CUDA_PATH = pkgs.lib.optionalString (variant == "CUDA") pkgs.cudatoolkit;
EXTRA_LDFLAGS = pkgs.lib.optionalString (
variant == "CUDA"
) "-L${pkgs.linuxPackages.nvidia_x11}/lib";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment