nixpkgs/pkgs/tools/admin/balena-cli/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
2.1 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, buildNpmPackage
2023-12-25 12:24:13 +01:00
, overrideSDK
, fetchFromGitHub
, testers
, balena-cli
, nodePackages
, python3
, udev
2023-08-31 08:30:27 +02:00
, darwin
}:
2023-12-25 12:24:13 +01: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 {
pname = "balena-cli";
2024-05-03 17:13:20 +02:00
version = "18.2.2";
src = fetchFromGitHub {
owner = "balena-io";
repo = "balena-cli";
rev = "v${version}";
2024-05-03 17:13:20 +02:00
hash = "sha256-3WJ8yxSwvYOs8LaUBgqALyxY1cMiHusBPzKbSeAxrCw=";
};
2024-05-03 17:13:20 +02:00
npmDepsHash = "sha256-sHjz0VWVM6x5iAbG9e6x4F6Gx2OpS94hDMvirExDt0M=";
postPatch = ''
ln -s npm-shrinkwrap.json package-lock.json
'';
makeCacheWritable = true;
nativeBuildInputs = [
nodePackages.node-gyp
python3
2023-08-31 08:30:27 +02:00
] ++ lib.optionals stdenv.isDarwin [
darwin.cctools
];
2023-08-31 08:30:27 +02:00
buildInputs = lib.optionals stdenv.isLinux [
udev
2023-08-31 08:30:27 +02:00
] ++ 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";
};
}