blob: a4e8550965e8f045c44ac1241c2146c235ca5345 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{
lib,
stdenvNoCC,
fetchurl,
autoPatchelfHook,
versionCheckHook,
}:
let
sources = {
aarch64-darwin = {
platform = "darwin-arm64";
hash = "sha256-6VuShal/PXmkrhEiJkpD9yUidAlE3i3I/xuSN2QYkm0=";
};
aarch64-linux = {
platform = "linux-arm64";
hash = "sha256-ms6gEn6bwS+Gh9qBQ0/mHkV4rn3eVW3eYm0+yqtFNQw=";
};
x86_64-linux = {
platform = "linux-x64";
hash = "sha256-KJ6AT/rlT+lY0L4+qDdNyAan40HTzzTl/sqBrQwfQb8=";
};
};
source = sources.${stdenvNoCC.hostPlatform.system};
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "twg-cli";
version = "1.4.6";
src = fetchurl {
url = "https://teamwork-graph.atlassian.com/cli/twg-${source.platform}-v${finalAttrs.version}";
inherit (source) hash;
};
dontUnpack = true;
dontBuild = true;
# Stripping removes the JavaScript payload embedded in the Bun executable.
dontStrip = true;
nativeBuildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ];
# Bun's localeCompare uses the system ICU data on macOS.
sandboxProfile = lib.optionalString stdenvNoCC.hostPlatform.isDarwin ''
(allow file-read* (subpath "/usr/share/icu"))
'';
installPhase = ''
runHook preInstall
install -Dm755 "$src" "$out/bin/twg"
runHook postInstall
'';
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgramArg = "--version";
meta = {
description = "Command-line interface for Atlassian Teamwork Graph";
homepage = "https://github.com/atlassian/twg-cli";
license = lib.licenses.unfree;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
mainProgram = "twg";
platforms = lib.attrNames sources;
};
})
|