nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchzip,
5 makeBinaryWrapper,
6 coreutils,
7 findutils,
8 jre,
9
10 testers,
11}:
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "appfire-cli";
15 version = "12.1.0";
16
17 src = fetchzip {
18 url = "https://appfire.atlassian.net/wiki/download/attachments/60562669/acli-${finalAttrs.version}-distribution.zip";
19 hash = "sha256-6p8i5ec8IAygACdsdzP8g5u24mQZ7Ci684xuu/kAADo=";
20 };
21
22 nativeBuildInputs = [ makeBinaryWrapper ];
23
24 installPhase = ''
25 runHook preInstall
26
27 mkdir -p $out/share/{,doc/}appfire-cli
28 cp -r acli.sh lib $out/share/appfire-cli
29 cp -r README.txt license $out/share/doc/appfire-cli
30
31 ACLI_SHELL=${finalAttrs.passthru.shellNames.${stdenv.hostPlatform.system} or "unsupport"}
32 if test -f $ACLI_SHELL; then
33 install -Dm755 $ACLI_SHELL $out/share/appfire-cli/$ACLI_SHELL
34 fi
35
36 substituteInPlace $out/share/appfire-cli/acli.sh \
37 --replace-fail 'java $' '${lib.getExe jre} $' \
38 --replace-fail '(find' '(${lib.getExe findutils}' \
39 --replace-fail dirname ${lib.getExe' coreutils "dirname"} \
40 --replace-fail uname ${lib.getExe' coreutils "uname"}
41 makeBinaryWrapper $out/share/appfire-cli/acli.sh $out/bin/acli
42
43 runHook postInstall
44 '';
45
46 passthru = {
47 shellNames = {
48 "x86_64-linux" = "bin/shell-linux-amd64";
49 "aarch64-linux" = "bin/shell-linux-arm64";
50 "x86_64-darwin" = "bin/shell-macos-amd64";
51 "aarch64-darwin" = "bin/shell-macos-arm64";
52 };
53 # versionCheckHook cannot be used because appfire-cli requires $HOME to be set
54 tests.version = testers.testVersion {
55 package = finalAttrs.finalPackage;
56 command = "acli -a getClientInfo";
57 };
58 };
59
60 meta = {
61 description = "Integrated family of CLIs for Atlassian, Atlassian-related, and other applications";
62 longDescription = ''
63 Appfire CLI (ACLI) is an integrated family of CLIs for Atlassian,
64 Atlassian-related, and other applications.
65
66 ACLI provides a consistent and reliable automation platform that allows
67 users, administrators, script writers, and DevOps developers to perform
68 tasks, implement business processes, or apply general automation with
69 Atlassian products.
70
71 The CLIs are built on the Atlassian remote APIs and deliver a higher
72 level, client-based API that is easier to use and more powerful than
73 the underlying product APIs.
74
75 The upstream documentation describes configuring acli by placing
76 {file}`acli.properties` in the same directory as {file}`acli.sh`.
77 Since the /nix/store is not writable, you can instead place the file
78 at {file}`$HOME/acli.properties` to achieve the same effect.
79 '';
80 homepage = "https://apps.appf.re/acli";
81 license = lib.licenses.unfreeRedistributable;
82 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
83 maintainers = with lib.maintainers; [ twey ];
84 mainProgram = "acli";
85 inherit (jre.meta) platforms;
86 };
87})