Flake for running SD on NixOS
nix run .#invokeai.{default,amd} -- --web --root_dir "folder for configs and models"
, wait for package to build
.#invokeai.default
builds package with default torch-bin that has CUDA-support by default.#invokeai.amd
builds package which overrides torch packages with ROCM-enabled bin versions--root_dir
to pick another location for configs/models installation. More fine-grained directory setup options also available - run nix run .#invokeai.amd -- --help
for more info.--
part of the nix run commandnix build .#invokeai.amd
and call those scripts manually like that: ./result/bin/invokeai-ti
.nix run .#webui.{default,amd} -- --data-dir "runtime folder for webui stuff" --ckpt-dir "folder with pre-downloaded main SD models"
, wait for packages to build
.#webui.default
builds package with default torch-bin that has CUDA-support by default.#webui.amd
builds package which overrides torch packages with ROCM-enabled bin versionsbin/flake-launch
is a top-level wrapper, which sets default args and is running by default. bin/launch.py
is a thin wrapper around original launch.py which only sets PYTHONPATH with required packages. Both wrappers pass additional args further down the pipeline. To list all available args you may run nix run .#webui.amd -- --help
.If you get an error "hipErrorNoBinaryForGpu: Unable to find code object for all current devices!"
, then probably your GPU is not fully supported by ROCM (only several gpus are by default) and you have to set env variable to trick ROCM into running - export HSA_OVERRIDE_GFX_VERSION=10.3.0
Contributions are welcome. I have no intention to keep up with development pace of these apps, especially the Automatic's fork :) . However, I will ocasionally update at least InvokeAI's flake. Considering versioning, I will try to follow semver with respect to submodules as well, which means major version bump for submodule = major version bump for this flake.
Many many thanks to https://github.com/cript0nauta/pynixify which generated all the boilerplate for missing python packages.
Also thanks to https://github.com/colemickens/stable-diffusion-flake and https://github.com/skogsbrus/stable-diffusion-nix-flake for inspiration and some useful code snippets.
You may want to check out Nixified-AI. It aims to support broader range (e.g. text models) of AI models in NixOS.