colemickens / stable-diffusion-flake

26 stars 1 forks source link

stable-diffusion-flake

status

on-hold, I'm a bit stretched too thin right now

status

Still a WIP - There is a working mode, but it relies on venv/pip-installing a bunch of crap. Ideally we can package the rest and remove the hacks and etc.

Both the worth hacky version (stable-diffusion-webui-pip.nix) and devlopment-ideal version (stable-diffusion-webui.nix) are documented here:

NOTE: This works with AUTOMATIC1111/stable-diffusion-webui as well

notes

contribute

Do you love Python? Do you have lots of spare time? Do you want to help make this a cool demo of Nix's usefulness especially in hairy-spaces like ML/python/etc?

I've mostly added the outlines of all listed packages in my stable-diff" nixpkgs branch. Feel free to just pick one and fix it up and then attempt to load the "default" devshell and see how far you get.

usage

# use the stable-diff cache (or just accept the flake settings)
> cachix use stable-diff

# prepare
mkdir -p "${HOME}/code/stable-diffusion-webui"
git clone "https://github.com/sd-webui/stable-diffusion-webui" "${HOME}/code/stable-diffusion-webui"

# enter the SD-WEBUI directory
# this assume you've already moved the model into place too!
cd "${HOME}/code/stable-diffusion-webui"

# enter a shell
> nix develop 'github:colemickens/stable-diffusion-flake#webui-pip'

## inside devshell, pip will install a bunch of extra stuff
## inside devshell, now launch the webui relauncher:
$ python scripts/relauncher.py

# wait...
# and now UI is running on port 7860

developer usage

# enter a shell
> nix develop "$HOME/code/stable-diffusion-flake#webui-pip" \
  --override-input "nixpkgs" "$HOME/code/nixpkgs/stable-diff"

future usage

nix run "github.com:colemickens/stable-diffusion-flake#webui"
# (first-time) accept suggested cache / trusted-keys
# wait...
# and now UI is running on port 7860

(and/or a nixos module...)

UX goal:

  1. user download model file to cache dir
  2. nix run
  3. launcher script hardlinks the model file
  4. launcher script then calls the web-ui's "relauncher" script

todo:

credits

screenshot