fix(nix): add desktop application entry (#8972)

pull/8993/head
Caleb Norton 2026-01-16 16:59:07 -06:00 committed by GitHub
parent 3d095e7fe7
commit aca1eb6b5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 0 deletions

View File

@ -15,6 +15,8 @@
cargo, cargo,
rustc, rustc,
makeBinaryWrapper, makeBinaryWrapper,
copyDesktopItems,
makeDesktopItem,
nodejs, nodejs,
jq, jq,
}: }:
@ -57,12 +59,28 @@ rustPlatform.buildRustPackage rec {
pkg-config pkg-config
bun bun
makeBinaryWrapper makeBinaryWrapper
copyDesktopItems
cargo cargo
rustc rustc
nodejs nodejs
jq jq
]; ];
# based on packages/desktop/src-tauri/release/appstream.metainfo.xml
desktopItems = lib.optionals stdenv.isLinux [
(makeDesktopItem {
name = "ai.opencode.opencode";
desktopName = "OpenCode";
comment = "Open source AI coding agent";
exec = "opencode-desktop";
icon = "opencode";
terminal = false;
type = "Application";
categories = [ "Development" "IDE" ];
startupWMClass = "opencode";
})
];
buildInputs = [ buildInputs = [
openssl openssl
] ]
@ -121,6 +139,10 @@ rustPlatform.buildRustPackage rec {
# It looks for them in the location specified in tauri.conf.json. # It looks for them in the location specified in tauri.conf.json.
postInstall = lib.optionalString stdenv.isLinux '' postInstall = lib.optionalString stdenv.isLinux ''
# Install icon
mkdir -p $out/share/icons/hicolor/128x128/apps
cp ../../../packages/desktop/src-tauri/icons/prod/128x128.png $out/share/icons/hicolor/128x128/apps/opencode.png
# Wrap the binary to ensure it finds the libraries # Wrap the binary to ensure it finds the libraries
wrapProgram $out/bin/opencode-desktop \ wrapProgram $out/bin/opencode-desktop \
--prefix LD_LIBRARY_PATH : ${ --prefix LD_LIBRARY_PATH : ${