From b5650040276216f1a857ca7522637e1f45748af4 Mon Sep 17 00:00:00 2001 From: "blu@blu.cx" <38222767+thebrandonlucas@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:08:16 -0500 Subject: [PATCH] build(gpui): build the app flake on macOS The flake marked buzz-gpui and buzz-gpui-voltage as Linux-only, so a macOS developer could not install the Voltage app through Nix. Gate the Linux-only inputs (Wayland, X11, Vulkan, ALSA, fontconfig, LD_LIBRARY_PATH, the .desktop file and icons) on Linux. On Darwin, turn on a new runtime-shaders feature, so GPUI compiles its Metal shaders at launch instead of with Xcode's xcrun, which Nix does not provide. --- apps/buzz-gpui/Cargo.lock | 1 + apps/buzz-gpui/crates/app/Cargo.toml | 7 ++++++ apps/buzz-gpui/flake.nix | 33 +++++++++++++++++----------- voltage/remote-agents.md | 14 ++++++++++-- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/apps/buzz-gpui/Cargo.lock b/apps/buzz-gpui/Cargo.lock index b8c401a688e..b5b174efa48 100644 --- a/apps/buzz-gpui/Cargo.lock +++ b/apps/buzz-gpui/Cargo.lock @@ -1083,6 +1083,7 @@ dependencies = [ "gpui-base", "gpui-kit", "gpui-pre-linux", + "gpui-pre-macos", "gstreamer", "gstreamer-app", "gstreamer-video", diff --git a/apps/buzz-gpui/crates/app/Cargo.toml b/apps/buzz-gpui/crates/app/Cargo.toml index cb089837ad7..ddde7496100 100644 --- a/apps/buzz-gpui/crates/app/Cargo.toml +++ b/apps/buzz-gpui/crates/app/Cargo.toml @@ -86,6 +86,9 @@ voltage-sandbox = [ "dep:buzz-session-control", "buzz-identity/session-control", ] +# Compile GPUI's Metal shaders at launch instead of with Xcode's `xcrun +# metal` at build time, for builds without Xcode (the Nix flake on macOS). +runtime-shaders = ["dep:gpui-pre-macos", "gpui-pre-macos/runtime_shaders"] [dev-dependencies] # Paused time for timing tests. @@ -108,6 +111,10 @@ arboard = "3" # The menu-bar or notification-area icon; Tauri's tray. tray-icon = { version = "0.26", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +# Only to turn on its runtime_shaders feature (see [features]). +gpui-pre-macos = { version = "=0.3.8", optional = true } + [target.'cfg(windows)'.dependencies] # The user's `buzz://` registration; GPUI already uses it. windows-registry = "0.6" diff --git a/apps/buzz-gpui/flake.nix b/apps/buzz-gpui/flake.nix index 03bf627d48a..a1528bf329c 100644 --- a/apps/buzz-gpui/flake.nix +++ b/apps/buzz-gpui/flake.nix @@ -14,7 +14,13 @@ // flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; - runtimeLibs = with pkgs; [ + inherit (pkgs.stdenv.hostPlatform) isLinux isDarwin; + runtimeLibs = (with pkgs; [ + freetype + openssl + dbus + sqlite + ]) ++ pkgs.lib.optionals isLinux (with pkgs; [ wayland vulkan-loader libxcb @@ -23,11 +29,7 @@ libxcursor libxi fontconfig - freetype - openssl - dbus - sqlite - ]; + ]); # Audio and video playback. GStreamer's setup hook puts each plugin # set on GST_PLUGIN_SYSTEM_PATH_1_0 inside the shell. playback = with pkgs.gst_all_1; [ @@ -38,7 +40,7 @@ ]; # Libraries the app needs when it runs, beyond those it links: the # audio backends GStreamer and the terminal use, and zstd. - appRuntimeLibs = runtimeLibs ++ (with pkgs; [ alsa-lib zstd ]); + appRuntimeLibs = runtimeLibs ++ [ pkgs.zstd ] ++ pkgs.lib.optional isLinux pkgs.alsa-lib; craneLib = crane.mkLib pkgs; version = "0.2.0"; sourceFilter = path: type: @@ -143,7 +145,8 @@ }; doCheck = false; nativeBuildInputs = with pkgs; [ pkg-config cmake perl makeWrapper ]; - buildInputs = runtimeLibs ++ playback ++ (with pkgs; [ vulkan-headers alsa-lib zstd ]); + buildInputs = runtimeLibs ++ playback ++ [ pkgs.zstd ] + ++ pkgs.lib.optionals isLinux (with pkgs; [ vulkan-headers alsa-lib ]); }; # Buzz's own Node plugins, built as scripts/package-deb.sh builds # them: each folder with a manifest ships it and its dist. @@ -179,8 +182,10 @@ # the Node that runs them in ../lib/buzz-gpui/node. gpuiPackage = { pname, features ? [ ], sandboxProviders ? null }: let - cargoFeatures = pkgs.lib.optionalString (features != [ ]) - " --features ${pkgs.lib.concatStringsSep "," features}"; + # Nix on macOS has no Xcode to compile the Metal shaders with. + features' = features ++ pkgs.lib.optional isDarwin "runtime-shaders"; + cargoFeatures = pkgs.lib.optionalString (features' != [ ]) + " --features ${pkgs.lib.concatStringsSep "," features'}"; args = gpuiArgs // { inherit pname; cargoExtraArgs = gpuiArgs.cargoExtraArgs + cargoFeatures; @@ -201,13 +206,14 @@ }); postInstall = '' wrapProgram $out/bin/buzz-gpui \ - --prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath appRuntimeLibs} \ + ${pkgs.lib.optionalString isLinux "--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath appRuntimeLibs}"} \ --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : ${pkgs.lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" playback} \ --suffix PATH : ${pkgs.lib.makeBinPath [ pkgs.ffmpeg ]} mkdir -p $out/lib/buzz-gpui/node/bin $out/share/buzz-gpui ln -s ${pkgs.nodejs_22}/bin/node $out/lib/buzz-gpui/node/bin/node cp -r ${plugins} $out/share/buzz-gpui/plugins chmod -R u+w $out/share/buzz-gpui/plugins + '' + pkgs.lib.optionalString isLinux '' install -Dm644 packaging/linux/buzz-gpui.desktop -t $out/share/applications for size in 128 256 512; do install -Dm644 assets/icons/buzz-$size.png \ @@ -220,7 +226,7 @@ passthru = { inherit plugins; }; meta = { mainProgram = "buzz-gpui"; - platforms = pkgs.lib.platforms.linux; + platforms = pkgs.lib.platforms.linux ++ pkgs.lib.platforms.darwin; }; }); in @@ -249,9 +255,10 @@ devShells.default = pkgs.mkShell { # The Rust toolchain buzzd is built with, so local and CI checks match. nativeBuildInputs = with pkgs; [ pkg-config cmake perl rustc cargo clippy rustfmt nodejs_22 ]; - buildInputs = runtimeLibs ++ playback ++ (with pkgs; [ vulkan-headers alsa-lib zstd ]); + buildInputs = gpuiArgs.buildInputs; env = { RUST_BACKTRACE = "1"; + } // pkgs.lib.optionalAttrs isLinux { LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs; }; }; diff --git a/voltage/remote-agents.md b/voltage/remote-agents.md index 4beff73388c..60214f87a8a 100644 --- a/voltage/remote-agents.md +++ b/voltage/remote-agents.md @@ -145,16 +145,26 @@ The developer's Buzz identity must be a member of the `buzz.voltage.cloud` commu ### 1. Install the Buzz app (Voltage build) -Remote workspace agents need the `buzz-gpui-voltage` package. On NixOS, add the flake input and install the package: +Remote workspace agents need the `buzz-gpui-voltage` package. The flake builds it on Linux and macOS. You need only Nix: the flake supplies every other prerequisite. + +To run it once: + +```sh +nix run 'github:voltagecloud/buzz/?dir=apps/buzz-gpui#buzz-gpui-voltage' +``` + +To install it on NixOS or nix-darwin, add the flake input and install the package: ```nix # flake.nix inputs buzz-gpui.url = "github:voltagecloud/buzz/?dir=apps/buzz-gpui"; -# configuration.nix +# configuration.nix or darwin-configuration.nix environment.systemPackages = [ buzz-gpui.packages.${system}.buzz-gpui-voltage ]; ``` +On macOS, the Nix build runs from the terminal, not from an app bundle, so the app does not show system notifications. + Sign in with your Buzz identity and join the `buzz.voltage.cloud` community. Install the GitHub CLI (`gh`) and sign in with `gh auth login`, so the app can add your signing key to GitHub.