Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/update-nix-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Update Nix Versions

on:
push:
tags:
- 'v[0-9]*'

permissions:
contents: read

jobs:
update-versions:
if: github.repository == 'block/buzz'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
persist-credentials: false

- name: Extract version from tag
id: version
env:
TAG: ${{ github.ref_name }}
run: |
VERSION="${TAG#v}"
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$'; then
echo "::error::Invalid version '$VERSION' from tag '$TAG'"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Update buzzVersion in versions.nix
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
sed -i 's/^ buzzVersion = ".*";$/ buzzVersion = "'"$VERSION"'";/' nix/versions.nix
echo "Updated buzzVersion to $VERSION"
grep 'buzzVersion' nix/versions.nix

- name: Create release tagger token
id: release-tagger
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.BUZZ_RELEASE_TAGGER_CLIENT_ID }}
private-key: ${{ secrets.BUZZ_RELEASE_TAGGER_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write

- name: Check for existing PR
id: existing
env:
GH_TOKEN: ${{ steps.release-tagger.outputs.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
PR_TITLE="chore(nix): update versions.nix to $VERSION"
EXISTING=$(gh pr list \
--repo "$GITHUB_REPOSITORY" \
--state open \
--head update-nix-versions/v"$VERSION" \
--json number,title \
--jq '.[].number' 2>/dev/null)
if [ -n "$EXISTING" ]; then
echo "PR #$EXISTING already exists for v$VERSION — skipping"
echo "enabled=false" >> "$GITHUB_OUTPUT"
else
echo "enabled=true" >> "$GITHUB_OUTPUT"
fi

- name: Create pull request
if: steps.existing.outputs.enabled == 'true'
env:
GH_TOKEN: ${{ steps.release-tagger.outputs.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
BRANCH="update-nix-versions/v${VERSION}"
git config user.name "buzz-release-bot"
git config user.email "buzz-release-bot@block.xyz"
git checkout -b "$BRANCH"
git add nix/versions.nix
git commit -s -m "chore(nix): update versions.nix to ${VERSION}"
git push origin "$BRANCH"
gh pr create \
--repo "$GITHUB_REPOSITORY" \
--base main \
--head "$BRANCH" \
--title "chore(nix): update versions.nix to ${VERSION}" \
--body "Automated update of \`nix/versions.nix\` triggered by the \`v${VERSION}\` release tag.

- Updates \`buzzVersion\` to \`${VERSION}\`
- Dependency hashes are unchanged; regenerate with \`nix build\` if lockfiles changed."
78 changes: 78 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
description = "Buzz desktop app";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
block-buzz = {
url = "github:block/buzz";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, block-buzz }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
{
packages.default = pkgs.callPackage ./nix/buzz.nix {
src = block-buzz;
};
});
}
148 changes: 148 additions & 0 deletions nix/buzz.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
lib,
rustPlatform,
fetchPnpmDeps,
fetchurl,
cmake,
cargo-tauri,
nodejs,
pnpm,
pnpmConfigHook,
pkg-config,
wrapGAppsHook4,
makeWrapper,
gst_all_1,
glib-networking,
openssl,
webkitgtk_4_1,
alsa-lib,
libopus,
dbus,
glib,
gtk3,
libsoup_3,
librsvg,
darwin,
libiconv,
stdenv,
src,
}:

let
versions = import ./versions.nix;

sherpaOnnxSystemConfig = versions.sherpaOnnx.systems.${stdenv.hostPlatform.system} or (builtins.throw "Unsupported platform: ${stdenv.hostPlatform.system}. Supported platforms: ${builtins.toString (builtins.attrNames versions.sherpaOnnx.systems)}");

sherpaOnnxArchive = fetchurl {
name = "sherpa-onnx-v${versions.sherpaOnnx.version}-${sherpaOnnxSystemConfig.urlSuffix}.tar.bz2";
url = "https://github.com/k2-fsa/sherpa-onnx/releases/download/v${versions.sherpaOnnx.version}/sherpa-onnx-v${versions.sherpaOnnx.version}-${sherpaOnnxSystemConfig.urlSuffix}.tar.bz2";
hash = sherpaOnnxSystemConfig.hash;
};

sidecarPackages = [ "buzz-acp" "buzz-agent" "buzz-dev-mcp" "git-credential-nostr" "buzz-cli" ];
sidecarBinNames = [ "buzz-acp" "buzz-agent" "buzz-dev-mcp" "git-credential-nostr" "buzz" ];

sidecars = rustPlatform.buildRustPackage {
pname = "buzz-sidecars";
version = versions.buzzVersion;

src = src;

cargoLock = {
lockFileContents = builtins.readFile (src + "/Cargo.lock");
outputHashes = versions.sidecarCargoOutputHashes;
};

cargoBuildFlags = lib.concatLists (map (p: [ "-p" p ]) sidecarPackages);
doCheck = false;

nativeBuildInputs = [
cmake
pkg-config
];

buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
openssl
];

meta = with lib; {
description = "Buzz sidecar binaries";
license = licenses.unfree;
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
};
};
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "buzz-desktop";
version = versions.buzzVersion;

src = src;

cargoRoot = "desktop/src-tauri";
buildAndTestSubdir = "desktop/src-tauri";

cargoLock = {
lockFileContents = builtins.readFile (src + "/desktop/src-tauri/Cargo.lock");
outputHashes = versions.desktopCargoOutputHashes;
};

doCheck = false;

pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs) pname version src;
pnpm = pnpm;
fetcherVersion = 4;
hash = versions.pnpmHash;
};

preBuild = ''
mkdir -p $TMPDIR/sherpa-onnx-archive
ln -sf ${sherpaOnnxArchive} $TMPDIR/sherpa-onnx-archive/sherpa-onnx-v${versions.sherpaOnnx.version}-${sherpaOnnxSystemConfig.urlSuffix}.tar.bz2
export SHERPA_ONNX_ARCHIVE_DIR=$TMPDIR/sherpa-onnx-archive
mkdir -p desktop/src-tauri/binaries
for bin in ${builtins.concatStringsSep " " sidecarBinNames}; do
cp ${sidecars}/bin/$bin desktop/src-tauri/binaries/$bin-${stdenv.hostPlatform.config}
done
'';

nativeBuildInputs = [
cmake
cargo-tauri.hook
nodejs
pnpmConfigHook
pnpm
pkg-config
] ++ lib.optionals stdenv.hostPlatform.isLinux [ wrapGAppsHook4 ];

buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
libopus
dbus
glib
gtk3
libsoup_3
librsvg
glib-networking
openssl
webkitgtk_4_1
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
darwin.apple_sdk.frameworks.AppKit
];

meta = with lib; {
description = "Buzz desktop app";
homepage = "https://buzz.ai";
license = licenses.unfree;
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
mainProgram = "buzz-desktop";
};
})
45 changes: 45 additions & 0 deletions nix/versions.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
# App release version — bump on every release. Keep in sync with:
# desktop/src-tauri/Cargo.toml, desktop/src-tauri/tauri.conf.json
buzzVersion = "0.5.0";

# sherpa-onnx static library archive for huddle audio.
# Per-platform archive URL and hash.
# Regenerate hashes after version bump: run
# nix-prefetch-url <url>
# for each platform.
sherpaOnnx = {
version = "1.13.4";
systems = {
"x86_64-linux" = {
urlSuffix = "linux-x64-static-lib";
hash = "sha256-mLDjGZZCb254JE284ZVVSPLGTo8BxL51uFr3zaoujVw=";
};
"aarch64-linux" = {
urlSuffix = "linux-aarch64-static-lib";
hash = "sha256-03xwig2hfcj88li5qk01i8h5x00gana9g3j3n7alkjbwg0b3dcr3";
};
"aarch64-darwin" = {
urlSuffix = "osx-arm64-static-lib";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
};
};

# Cargo.lock output hashes for sidecar builds (workspace root Cargo.lock).
# Regenerate after Cargo.lock changes: remove one, nix build will error with the correct hash.
sidecarCargoOutputHashes = {
"aws-creds-0.39.1" = "sha256-QAAm1phmeLFtDRgfDCoHijN1ce/rYzh18KziOUbL+hw=";
"mesh-llm-api-client-0.73.1" = "sha256-2ArkxK7Ze13mqkQB+JkuqVSCLeHpdxXHMZ0592VyEWw=";
};

# Cargo.lock output hashes for the desktop Tauri build (desktop/src-tauri/Cargo.lock).
# Same package may have a different hash vs. sidecars due to different dep trees.
desktopCargoOutputHashes = {
"mesh-llm-api-client-0.73.1" = "sha256-OItlWwacyTtdS6LQCQDPlLmB09l4bbTX27uI8AGDQpk=";
};

# Hash for pnpm dependencies (desktop frontend).
# Regenerate after package.json / pnpm-lock.yaml changes: remove and let nix build fetch.
pnpmHash = "sha256-Tboy+MG/VvdxUpJw7Xv0oubK58MIpvChvbU30uO4M4A=";
}