Files
Willy Hille b60fec0971 balena-cli: install balena-compose-parser binary into @balena/compose-parser
required for `balena push` with docker compose files (multi container release), crashes with cryptic errors/stacktrace otherwise
2026-07-09 16:46:36 +02:00

83 lines
2.1 KiB
Nix

{
lib,
stdenv,
balena-compose-parser,
buildNpmPackage,
fetchFromGitHub,
nodejs_24,
versionCheckHook,
node-gyp,
python3,
udev,
xcbuild,
}:
let
buildNpmPackage' = buildNpmPackage.override {
nodejs = nodejs_24;
};
node-gyp' = node-gyp.override {
nodejs = nodejs_24;
};
in
buildNpmPackage' rec {
pname = "balena-cli";
version = "25.1.6";
src = fetchFromGitHub {
owner = "balena-io";
repo = "balena-cli";
rev = "v${version}";
hash = "sha256-ipl8eK9DpMGd4kyr46QTMUqYfr5ghOY3u5WS1GXVeIw=";
};
npmDepsHash = "sha256-HAOZlCRcPjX0u9GBLaYR03Jb+bvg679MqcGGHkQ2FPM=";
makeCacheWritable = true;
nativeBuildInputs = [
node-gyp'
python3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
xcbuild
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
udev
];
postInstall = ''
cp ${lib.getExe balena-compose-parser} $out/lib/node_modules/balena-cli/node_modules/@balena/compose-parser/bin/
'';
nativeInstallCheckInputs = [
versionCheckHook
];
# Disabled on Darwin due to:
#
# https://github.com/NixOS/nix/issues/5748
#
# No matter whether $TMP and $HOME point to real writable directories, the
# Darwin sandbox tries to use /var/empty and fails.
doInstallCheck = !stdenv.hostPlatform.isDarwin;
versionCheckProgram = "${placeholder "out"}/bin/balena";
meta = {
description = "Command line interface for balenaCloud or openBalena";
longDescription = ''
The balena CLI is a Command Line Interface for balenaCloud or openBalena. It is a software
tool available for Windows, macOS and Linux, used through a command prompt / terminal window.
It can be used interactively or invoked in scripts. The balena CLI builds on the balena API
and the balena SDK, and can also be directly imported in Node.js applications.
'';
homepage = "https://github.com/balena-io/balena-cli";
changelog = "https://github.com/balena-io/balena-cli/blob/v${version}/CHANGELOG.md";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
kalebpace
];
mainProgram = "balena";
};
}