btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / ba / balena-cli / package.nix
blobee9eb2e640ae645336f7fad959cca8665158d801
2   lib,
3   stdenv,
4   buildNpmPackage,
5   fetchFromGitHub,
6   testers,
7   balena-cli,
8   node-gyp,
9   python3,
10   udev,
11   cctools,
12   apple-sdk_12,
13   darwinMinVersionHook,
16 buildNpmPackage rec {
17   pname = "balena-cli";
18   version = "19.0.13";
20   src = fetchFromGitHub {
21     owner = "balena-io";
22     repo = "balena-cli";
23     rev = "v${version}";
24     hash = "sha256-2U+P3LsxaRpktNbDn8iNhHQVjokiWZADYVDpJsDosZU=";
25   };
27   npmDepsHash = "sha256-CA6qs9Gk19dEK2yCFMVVKmJSoZVLdpnf4V6P5fv2Bcc=";
29   postPatch = ''
30     ln -s npm-shrinkwrap.json package-lock.json
31   '';
32   makeCacheWritable = true;
34   nativeBuildInputs =
35     [
36       node-gyp
37       python3
38     ]
39     ++ lib.optionals stdenv.hostPlatform.isDarwin [
40       cctools
41     ];
43   buildInputs =
44     lib.optionals stdenv.hostPlatform.isLinux [
45       udev
46     ]
47     ++ lib.optionals stdenv.hostPlatform.isDarwin [
48       apple-sdk_12
49     ];
51   passthru.tests.version = testers.testVersion {
52     package = balena-cli;
53     command = ''
54       # Override default cache directory so Balena CLI's unavoidable update check does not fail due to write permissions
55       BALENARC_DATA_DIRECTORY=./ balena --version
56     '';
57     inherit version;
58   };
60   meta = with lib; {
61     description = "Command line interface for balenaCloud or openBalena";
62     longDescription = ''
63       The balena CLI is a Command Line Interface for balenaCloud or openBalena. It is a software
64       tool available for Windows, macOS and Linux, used through a command prompt / terminal window.
65       It can be used interactively or invoked in scripts. The balena CLI builds on the balena API
66       and the balena SDK, and can also be directly imported in Node.js applications.
67     '';
68     homepage = "https://github.com/balena-io/balena-cli";
69     changelog = "https://github.com/balena-io/balena-cli/blob/v${version}/CHANGELOG.md";
70     license = licenses.asl20;
71     maintainers = [
72       maintainers.kalebpace
73       maintainers.doronbehar
74     ];
75     mainProgram = "balena";
76   };