I couldn’t find UnstableFusion in the AUR so I put together a PKGBUILD for it. Perhaps someone with experience as package maintainer could publish this to AUR. This package is only for nvidia gpus with cuda support. If anyone knows how to adapt this PKGBUILD to support all gpus please post the changes needed.
Caution: If your bandwidth is limited you may not want to install this package. It can take upwards of 9gb to download the dependencies and runtimes (downloaded when you generate first image). Run it from your console the first time to view download progress.
pkgname=unstablefusion
pkgver=1.0
pkgrel=1
pkgdesc="A Stable Diffusion desktop frontend with inpainting, img2img and more"
arch=('x86_64')
url="https://github.com/ahrm/UnstableFusion"
license=('GPLv3')
depends=(
'numactl'
'python-pyqt5'
'python-numpy'
'python-pytorch-cuda'
'python-pillow'
'python-requests'
'python-flask'
'protobuf'
'python-qasync'
'python-httpx'
'python-pip'
'python-setuptools'
)
makedepends=('imagemagick')
conflicts=('python-opencv')
source=(
"${pkgname}.tar.gz::${url}/archive/refs/tags/v1.tar.gz"
)
sha256sums=(
'8101c362802d0c4ccaa2b75a82ff86087b03cdaf0219037943376145f377f824'
)
prepare() {
pip install accelerate diffusers transformers opencv-python-headless
echo -ne "#!/bin/bash\n\npython /usr/lib/python3.10/${pkgname}/${pkgname}.py" > "${srcdir}/UnstableFusion-1/${pkgname}"
echo -ne "[Desktop Entry]\nName=UnstableFusion\nComment=${pkgdesc}\nExec=${pkgname}\nIcon=${pkgname}\nStartupNotify=false\nTerminal=false\nType=Application\nCategories=Graphics;2DGraphics;" > "${srcdir}/UnstableFusion-1/${pkgname}.desktop"
convert "${srcdir}/UnstableFusion-1/icons/${pkgname}.png" -resize 32x32 "${srcdir}/UnstableFusion-1/icons/${pkgname}32.png"
}
package() {
cd "${srcdir}/UnstableFusion-1"
for f in ./*; do
if [ -f "$f" ]; then
bf=$(basename -- "${f}")
install -Dm644 "${f}" "${pkgdir}/usr/lib/python3.10/${pkgname}/${bf}"
fi
done
for f in ./icons/*; do
bf=$(basename -- "${f}")
install -Dm644 "${f}" "${pkgdir}/usr/lib/python3.10/${pkgname}/icons/${bf}"
done
install -Dm644 "${srcdir}/UnstableFusion-1/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -Dm644 "${srcdir}/UnstableFusion-1/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
install -Dm644 "${srcdir}/UnstableFusion-1/icons/${pkgname}32.png" "${pkgdir}/usr/share/icons/hicolor/32x32/apps/${pkgname}.png"
install -Dm755 "${srcdir}/UnstableFusion-1/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
}
The pip line was necessary since those packages aren’t in the manjaro repo. Not sure how to list them in the depends array so pip was a last resort.
I know the python3.10 folder is not ideal. I could check the python version during install and then insert the version into the path. But even that might break after a python upgrade. Which folder would you use for the python scripts?
Sometimes during preparing, building, testing or installation it is required to refer to the system’s major and minor Python version. Do not hardcode this (e.g. 3.9 or 3.10) and instead use a call to the Python interpreter to retrieve the information and store it in a local variable: