nixpkgs/pkgs/tools/admin/balena-cli/default.nix
2023-08-31 15:59:02 +03:00

69 lines
1.9 KiB
Nix

{ lib
, stdenv
, buildNpmPackage
, fetchFromGitHub
, testers
, balena-cli
, nodePackages
, python3
, udev
, darwin
}:
buildNpmPackage rec {
pname = "balena-cli";
version = "17.0.0";
src = fetchFromGitHub {
owner = "balena-io";
repo = "balena-cli";
rev = "v${version}";
hash = "sha256-sNpxjSumiP+4fX6b3j+HEl/lr4pvudrhfTzr2TYastE=";
};
npmDepsHash = "sha256-q2Yc6e5dEiP2Q4tFIeqj4mswM1/pX1pdGeoagyiupvs=";
postPatch = ''
ln -s npm-shrinkwrap.json package-lock.json
'';
makeCacheWritable = true;
nativeBuildInputs = [
nodePackages.node-gyp
python3
] ++ lib.optionals stdenv.isDarwin [
darwin.cctools
];
buildInputs = lib.optionals stdenv.isLinux [
udev
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.Cocoa
];
passthru.tests.version = testers.testVersion {
package = balena-cli;
command = ''
# Override default cache directory so Balena CLI's unavoidable update check does not fail due to write permissions
BALENARC_DATA_DIRECTORY=./ balena --version
'';
inherit version;
};
meta = with lib; {
description = "A 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 = licenses.asl20;
maintainers = [ maintainers.kalebpace maintainers.doronbehar ];
mainProgram = "balena";
};
}