2023-03-24 00:07:29 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2023-10-09 19:29:22 +00:00
|
|
|
, buildNpmPackage
|
2024-01-02 11:29:13 +00:00
|
|
|
, overrideSDK
|
2023-10-09 19:29:22 +00:00
|
|
|
, fetchFromGitHub
|
2023-03-24 00:07:29 +00:00
|
|
|
, testers
|
2023-10-09 19:29:22 +00:00
|
|
|
, balena-cli
|
|
|
|
, nodePackages
|
|
|
|
, python3
|
|
|
|
, udev
|
|
|
|
, darwin
|
2023-03-24 00:07:29 +00:00
|
|
|
}:
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
let
|
|
|
|
# Fix for: https://github.com/NixOS/nixpkgs/issues/272156
|
|
|
|
buildNpmPackage' = buildNpmPackage.override {
|
|
|
|
stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
|
|
|
|
};
|
|
|
|
in buildNpmPackage' rec {
|
2023-03-24 00:07:29 +00:00
|
|
|
pname = "balena-cli";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "18.2.4";
|
2023-03-24 00:07:29 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "balena-io";
|
|
|
|
repo = "balena-cli";
|
|
|
|
rev = "v${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-cn6H8dFRZDK/ye0zqS+BXQzlBPpSfdotrp+TuQZ1Hko=";
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
2023-03-24 00:07:29 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
npmDepsHash = "sha256-5ri/eb85MPzjBac20WFMiD2cBux4grIyjGflQMW66bQ=";
|
2023-03-24 00:07:29 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postPatch = ''
|
|
|
|
ln -s npm-shrinkwrap.json package-lock.json
|
2023-03-24 00:07:29 +00:00
|
|
|
'';
|
2023-10-09 19:29:22 +00:00
|
|
|
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
|
|
|
|
];
|
2023-03-24 00:07:29 +00:00
|
|
|
|
|
|
|
passthru.tests.version = testers.testVersion {
|
2023-10-09 19:29:22 +00:00
|
|
|
package = balena-cli;
|
2023-03-24 00:07:29 +00:00
|
|
|
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; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Command line interface for balenaCloud or openBalena";
|
2023-03-24 00:07:29 +00:00
|
|
|
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;
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = [ maintainers.kalebpace maintainers.doronbehar ];
|
2023-03-24 00:07:29 +00:00
|
|
|
mainProgram = "balena";
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
}
|