Files
millerson-overlay.nix/packages/pilotdeck/package.nix
T
alex a46a2bb967
CI / check (push) Has been cancelled
fix(pilotdeck): build from source
Replace the prebuilt Debian package with the documented source build. Build the web UI and gateway with pnpm, stage the pinned Cua driver, and start the web UI from the wrapper.
2026-10-19 21:52:37 +03:00

214 lines
5.0 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
fetchurl,
fetchPnpmDeps,
pnpmConfigHook,
nodejs_22,
nodejs-slim_22,
pnpm_10,
python3,
makeWrapper,
ripgrep,
git,
curl,
procps,
bashInteractive,
coreutils,
findutils,
gnugrep,
gnused,
libx11,
libxi,
libxtst,
libxext,
libxkbcommon,
wayland,
at-spi2-core,
}:
let
version = "2026.10.17";
# Keep the source, LFS asset, pnpm dependency, and Cua driver hashes in
# sync with the upstream release when updating the version.
pnpm = pnpm_10.override { nodejs-slim = nodejs-slim_22; };
# Git LFS objects used by the web UI and the memory-core package. The
# upstream tarball contains pointer files, so fetch these paths through
# git-lfs and overlay them on the source tree.
lfsAssets = fetchFromGitHub {
owner = "OpenBMB";
repo = "PilotDeck";
tag = "v${version}";
fetchLFS = true;
sparseCheckout = [
"ui/public"
"src/context/memory/edgeclaw-memory-core/ui-source/assets"
];
hash = "sha256-R0bMxC6B2XqJMzuBnHmlNPX65tIwxL5FUc6Vv5M3O7w=";
};
cuaDriver =
{
x86_64-linux = fetchurl {
url = "https://github.com/trycua/cua/releases/download/cua-driver-rs-v0.34.1/cua-driver-rs-0.34.1-linux-x86_64-binary.tar.gz";
hash = "sha256-pB/ivcvupFAdxZTAdPFrCXVyjgzHsIuQrOqFZNSPr+4=";
};
aarch64-linux = fetchurl {
url = "https://github.com/trycua/cua/releases/download/cua-driver-rs-v0.34.1/cua-driver-rs-0.34.1-linux-arm64-binary.tar.gz";
hash = "sha256-HIOdNUAbveog8+HPUKzpJu8Xvm8yzqfoIbArJjxJM9w=";
};
}
.${stdenv.hostPlatform.system}
or (throw "pilotdeck: unsupported system ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation (finalAttrs: {
pname = "pilotdeck";
inherit version;
src = fetchFromGitHub {
owner = "OpenBMB";
repo = "PilotDeck";
tag = "v${version}";
hash = "sha256-VgsMoaaAtLIieBr4TchP61u5xV3PnVqjviak6DN7TPY=";
};
pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs)
pname
version
src
;
inherit pnpm;
pnpmWorkspaces = [
"pilotdeck"
"pilotdeck-ui"
];
fetcherVersion = 4;
hash = "sha256-yhLx1PGSGoyds8lUe3cKpqMWgITwic5YTxugATARV7Y=";
};
pnpmWorkspaces = [
"pilotdeck"
"pilotdeck-ui"
];
nativeBuildInputs = [
nodejs_22
pnpm
pnpmConfigHook
python3
makeWrapper
];
env = {
# node-gyp must use the headers of the Node.js runtime that will execute
# the native addons, rather than downloading headers from nodejs.org.
npm_config_nodedir = nodejs_22;
npm_config_offline = "true";
pnpm_config_offline = "true";
};
postUnpack = ''
cp -r ${lfsAssets}/ui/public/. source/ui/public/
cp -r ${lfsAssets}/src/context/memory/edgeclaw-memory-core/ui-source/assets/. \
source/src/context/memory/edgeclaw-memory-core/ui-source/assets/
'';
preConfigure = ''
export HOME=$TMPDIR
'';
buildPhase = ''
runHook preBuild
# pnpmConfigHook installs dependencies with --ignore-scripts. Run the
# allowed lifecycle scripts now. better-sqlite3 and node-pty fall back to
# a source build when their prebuilt download is unavailable, while sharp
# uses its prebuilt @img/sharp-* optional dependency.
pnpm rebuild
pnpm --filter pilotdeck-ui rebuild
# The build script verifies and stages the pinned Cua computer-use driver.
# Point it at the Nix store instead of letting it download the archive.
export PILOTDECK_CUA_ARCHIVE=${cuaDriver}
pnpm run build:web
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib/pilotdeck
cp -r \
package.json \
tsconfig.json \
node_modules \
dist \
src \
scripts \
skills \
resources \
$out/lib/pilotdeck/
mkdir -p $out/lib/pilotdeck/ui
cp -r \
ui/package.json \
ui/server \
ui/dist \
ui/public \
ui/scripts \
ui/shared \
ui/vite.config.js \
ui/node_modules \
$out/lib/pilotdeck/ui/
makeWrapper ${lib.getExe nodejs_22} $out/bin/pilotdeck \
--add-flags "$out/lib/pilotdeck/ui/server/webRuntimeSupervisor.js start-built" \
--prefix PATH : ${
lib.makeBinPath [
nodejs_22
ripgrep
git
curl
procps
bashInteractive
coreutils
findutils
gnugrep
gnused
]
} \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
libx11
libxi
libxtst
libxext
libxkbcommon
wayland
at-spi2-core
stdenv.cc.cc.lib
]
}
runHook postInstall
'';
passthru.category = "AI Agents";
meta = {
description = "Task-oriented AI Agent productivity platform (source-built web UI and gateway)";
homepage = "https://github.com/OpenBMB/PilotDeck";
license = lib.licenses.agpl3Only;
mainProgram = "pilotdeck";
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
})