buzz/snap/snapcraft.yaml
2025-10-18 09:25:02 +03:00

244 lines
7.8 KiB
YAML

# Development notes:
# - To build the snap run `snapcraft clean` and `snapcraft pack --verbose`
# - To install local snap `snap install ./buzz_*.snap --dangerous`
name: buzz
base: core22
version: git
summary: Buzz, offline audio transcription and translation
website: https://buzzcaptions.com
source-code: https://github.com/chidiwilliams/buzz
issues: https://github.com/chidiwilliams/buzz/issues
description: |
Buzz transcribes and translates audio to text offline using OpenAI's Whisper.
Import audio and video files into Buzz and export them as TXT, SRT, or VTT files.
Buzz supports Whisper, Whisper.cpp, Faster Whisper, Whisper-compatible models
from the Hugging Face repository, and the OpenAI Whisper API.
grade: stable
confinement: strict
license: MIT
icon: buzz/assets/buzz.svg
architectures:
- build-on: amd64
parts:
desktop-qt5:
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: qt
plugin: make
make-parameters: [ "FLAVOR=qt5" ]
build-packages:
- build-essential
- qtbase5-dev
- dpkg-dev
stage-packages:
- libxkbcommon0
- fonts-ubuntu
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-standard
- shared-mime-info
- libqt5gui5
- libgdk-pixbuf2.0-0
- libqt5svg5 # for loading icon themes which are svg
- libglib2.0-0
- xdg-user-dirs
override-prime: |
craftctl default
glib-compile-schemas usr/share/glib-2.0/schemas
platform-modules:
plugin: nil
stage-packages:
- appmenu-gtk3-module
- libcanberra-gtk3-module
qt5-gtk-platform:
plugin: nil
stage-packages:
- qt5-gtk-platformtheme
alsa-pulseaudio:
plugin: dump
source: .
override-pull: |
mkdir etc -p
cat > etc/asound.conf <<EOF
pcm.!default {
type pulse
fallback "sysdefault"
hint {
show on
description "Default ALSA Output (currently PulseAudio Sound Server)"
}
}
ctl.!default {
type pulse
fallback "sysdefault"
}
EOF
buzz:
plugin: python
source: .
build-packages:
- wget
- portaudio19-dev
- qt6-declarative-dev
- qt6-multimedia-dev
- libvulkan-dev
- cmake
stage-packages:
# Audio
- ffmpeg
- libportaudio2
- libpulse0
- libasound2
- libasound2-plugins
- libasound2-plugins-extra
- libyaml-dev
- libegl1-mesa
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-base-apps
- gstreamer1.0-pulseaudio
- libgstreamer1.0-0
- libgstreamer-plugins-base1.0-0
- libgstreamer-plugins-good1.0-0
# Display
- libxkbcommon-x11-0
- libxcb-icccm4
- libxcb-image0
- libxcb-keysyms1
- libxcb-randr0
- libxcb-render-util0
- libxcb-xinerama0
- libxcb-shape0
- libxcb-cursor0
# GPU
- libglu1-mesa
- libvulkan1
- mesa-vulkan-drivers
python-packages:
- ctypesgen
- setuptools
- cmake
- polib
override-build: |
# https://vulkan.lunarg.com/doc/view/latest/linux/getting_started_ubuntu.html
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | tee /etc/apt/trusted.gpg.d/lunarg.asc
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
apt update
apt install -y vulkan-sdk
# Clear cache to save space on CI
apt clean
craftctl default
pip install poetry
make translation_mo
pip install .
pip uninstall -y torch torchaudio nvidia-cublas-cu12 nvidia-cuda-cupti-cu12 nvidia-cuda-nvrtc-cu12 nvidia-cuda-runtime-cu12 nvidia-cudnn-cu12 nvidia-cufft-cu12 nvidia-cufile-cu12 nvidia-curand-cu12 nvidia-cusolver-cu12 nvidia-cusparse-cu12 nvidia-cusparselt-cu12 nvidia-nccl-cu12 nvidia-nvjitlink-cu12 nvidia-nvtx-cu12
pip cache purge
pip install -U torch==2.7.1+cu128 torchaudio==2.7.1+cu128 --index-url https://download.pytorch.org/whl/cu128
pip cache purge
pip install nvidia-cublas-cu12==12.8.3.14 nvidia-cuda-cupti-cu12==12.8.57 nvidia-cuda-nvrtc-cu12==12.8.61 --extra-index-url https://pypi.ngc.nvidia.com
pip cache purge
pip install nvidia-cuda-runtime-cu12==12.8.57 nvidia-cudnn-cu12==9.7.1.26 nvidia-cufft-cu12==11.3.3.41 --extra-index-url https://pypi.ngc.nvidia.com
pip cache purge
pip install nvidia-curand-cu12==10.3.9.55 nvidia-cusolver-cu12==11.7.2.55 nvidia-cusparse-cu12==12.5.7.53 --extra-index-url https://pypi.ngc.nvidia.com
pip cache purge
pip install nvidia-cusparselt-cu12==0.6.3 nvidia-nvjitlink-cu12==12.8.61 nvidia-nvtx-cu12==12.8.55 --extra-index-url https://pypi.ngc.nvidia.com
pip cache purge
python3 build.py
mkdir $CRAFT_PART_INSTALL/buzz
cp -r $CRAFT_PART_BUILD/buzz/whisper_cpp $CRAFT_PART_INSTALL/buzz/
# Create desktop file
mkdir -p $CRAFT_PART_INSTALL/usr/share/applications
cp $CRAFT_PART_BUILD/buzz.desktop $CRAFT_PART_INSTALL/usr/share/applications/
after: [ desktop-qt5 ]
graphics-core22:
after: [ buzz ]
source: https://github.com/canonical/gpu-snap.git
plugin: dump
override-prime: |
craftctl default
${CRAFT_PART_SRC}/bin/graphics-core22-cleanup mesa-core22 nvidia-core22
stage:
- ./*
- -venv/**
prime:
- ./*
- -venv/**
- bin/graphics-core22-wrapper
apps:
buzz:
command-chain:
- bin/graphics-core22-wrapper
command: bin/desktop-launch python3 -m buzz
desktop: usr/share/applications/buzz.desktop
environment:
PATH: $SNAP/usr/bin:$SNAP/bin:$PATH
LD_LIBRARY_PATH: $SNAP/lib/python3.10/site-packages/nvidia/cudnn/lib:$SNAP/lib/python3.10/site-packages/PyQt6:$SNAP/lib/python3.10/site-packages/PyQt6/Qt6/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP:$LD_LIBRARY_PATH
PYTHONPATH: $SNAP/lib/python3.10/site-packages/PyQt6:$SNAP/lib/python3.10/site-packages/PyQt6/Qt6/lib:$SNAP/usr/lib/python3/dist-packages:$SNAP/usr/lib/python3.10/site-packages:$SNAP/usr/local/lib/python3.10/dist-packages:$SNAP/usr/lib/python3.10/dist-packages:$PYTHONPATH
# Fallback to XWayland if running in a Wayland session.
DISABLE_WAYLAND: 1
# Use GTK3 cursor theme, icon theme and open/save file dialogs.
QT_QPA_PLATFORMTHEME: gtk3
QT_MEDIA_BACKEND: gstreamer
ALSA_CONFIG_PATH: $SNAP/etc/asound.conf
XDG_CONFIG_DIRS: $SNAP/etc/xdg:$XDG_CONFIG_DIRS
XDG_DATA_DIRS: $SNAP/usr/share:$XDG_DATA_DIRS
plugs:
- x11
- unity7
- wayland
- home
- network
- network-bind
- desktop
- desktop-legacy
- gsettings
- opengl
- removable-media
- audio-playback
- audio-record
- password-manager-service
plugs:
gtk-2-engines:
interface: content
target: $SNAP/lib/gtk-2.0
default-provider: gtk2-common-themes
gtk-3-themes:
interface: content
target: $SNAP/share/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/share/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/share/sounds
default-provider: gtk-common-themes
graphics-core22:
interface: content
target: $SNAP/graphics
default-provider: mesa-core22
layout:
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib:
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
/usr/share/libdrm:
bind: $SNAP/graphics/libdrm
/usr/share/drirc.d:
symlink: $SNAP/graphics/drirc.d
/usr/share/X11/XErrorDB:
symlink: $SNAP/graphics/X11/XErrorDB
/usr/share/X11/locale:
symlink: $SNAP/graphics/X11/locale