feat(computer-use): package computer-use-linux and cua-driver

Package the prebuilt releases (computer-use-linux v0.7.1 and
cua-driver-rs v0.24.0) under pkgs/, injected through thin callPackage
overlays so they are easy to relocate to the NUR repository later.
This commit is contained in:
Ryan Yin committed 2026-09-21 21:31:27 +08:00
1 parent ef00eb31e0
commit 90761a6b73
4 files changed
+117

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
_: _final: prev: {
computer-use-linux = prev.callPackage ../pkgs/computer-use-linux { };
}
+3
View File
@@ -0,0 +1,3 @@
_: _final: prev: {
cua-driver = prev.callPackage ../pkgs/cua-driver { };
}
+56
View File
@@ -0,0 +1,56 @@
{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
}:
let
version = "0.7.1";
# Prebuilt release binaries; the crate is not packaged in nixpkgs.
assets = {
x86_64-linux = {
target = "x86_64-unknown-linux-gnu";
hash = "sha256-Wp91gQrUKBjIoxIeEsRug4MYgZ6o6bcaDJoqq+RmmbQ=";
};
aarch64-linux = {
target = "aarch64-unknown-linux-gnu";
hash = "sha256-e376naC15EyNGfDN3ERTmvCPzd97v7WPzzVYq4zCjps=";
};
};
asset =
assets.${stdenv.hostPlatform.system}
or (throw "computer-use-linux: unsupported system ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation {
pname = "computer-use-linux";
inherit version;
src = fetchurl {
url = "https://github.com/agent-sh/computer-use-linux/releases/download/v${version}/computer-use-linux-${asset.target}";
inherit (asset) hash;
};
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ stdenv.cc.cc.lib ];
dontUnpack = true;
installPhase = ''
runHook preInstall
install -Dm755 $src $out/bin/computer-use-linux
runHook postInstall
'';
meta = {
description = "MCP server and CLI to control a Linux desktop";
homepage = "https://github.com/agent-sh/computer-use-linux";
license = lib.licenses.mit;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
mainProgram = "computer-use-linux";
};
}
+55
View File
@@ -0,0 +1,55 @@
{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
libxkbcommon,
xorg,
}:
let
version = "0.24.0";
# Prebuilt release binary; the crate is not packaged in nixpkgs.
asset = {
url = "https://github.com/trycua/cua/releases/download/cua-driver-rs-v${version}/cua-driver-rs-${version}-linux-x86_64-binary.tar.gz";
hash = "sha256-s7j/Ullf6xESGaoKyQ47NmGMxoaqggWu1PPn4aZ8e2Q=";
};
in
stdenv.mkDerivation {
pname = "cua-driver";
inherit version;
src = fetchurl asset;
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
stdenv.cc.cc.lib
xorg.libX11
xorg.libXi
libxkbcommon
];
sourceRoot = ".";
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
install -Dm755 cua-driver $out/bin/cua-driver
install -Dm755 cua-cursor-theme $out/lib/cua-driver/cua-cursor-theme
install -Dm755 libcua_driver_sdk.so $out/lib/cua-driver/libcua_driver_sdk.so
install -Dm755 cua_driver_node_runtime.node $out/lib/cua-driver/cua_driver_node_runtime.node
install -Dm644 cua_driver_abi.h $out/include/cua-driver/cua_driver_abi.h
mkdir -p $out/share/cua-driver
cp -r wayland-helper $out/share/cua-driver/wayland-helper
runHook postInstall
'';
meta = {
description = "Desktop-automation driver for computer-use agents (MCP/CLI)";
homepage = "https://github.com/trycua/cua";
license = lib.licenses.mit;
platforms = [ "x86_64-linux" ];
mainProgram = "cua-driver";
};
}