1{ lib
2, buildNpmPackage
3, fetchFromGitHub
4, installShellFiles
5, testers
6, node-manta
7}:
8
9buildNpmPackage rec {
10 pname = "manta";
11 version = "5.4.2";
12
13 src = fetchFromGitHub {
14 owner = "TritonDataCenter";
15 repo = "node-manta";
16 rev = "v${version}";
17 hash = "sha256-Uj3fNzeERiO++sW2uyAbtfN/1Ed6uRVBBvCecncq/QY=";
18 };
19
20 npmDepsHash = "sha256-Xk/K90K+X73ZTV6u2GJij8815GdBn6igXmpWLaCfKF4=";
21
22 dontBuild = true;
23
24 nativeBuildInputs = [ installShellFiles ];
25
26 postInstall = ''
27 ln -s ./lib/node_modules/manta/bin $out/bin
28 '';
29
30 postFixup = ''
31 # create completions, following upstream procedure https://github.com/joyent/node-manta/blob/v5.4.1/Makefile#L85-L91
32 cmds=$(find ./bin/ -type f -printf "%f\n")
33
34 node $out/lib/node_modules/manta/lib/create_client.js
35
36 for cmd in $cmds; do
37 installShellCompletion --cmd $cmd --bash <($out/bin/$cmd --completion)
38
39 # Strip timestamp from generated bash completion
40 sed -i '/Bash completion generated.*/d' $out/share/bash-completion/completions/$cmd.bash
41 done
42 '';
43
44 passthru = {
45 tests.version = testers.testVersion {
46 package = node-manta;
47 };
48 };
49
50 meta = with lib; {
51 description = "Manta Object-Storage Client CLIs and Node.js SDK";
52 homepage = "https://github.com/TritonDataCenter/node-manta";
53 changelog = "https://github.com/TritonDataCenter/node-manta/blob/v${version}/CHANGES.md";
54 license = licenses.mit;
55 maintainers = with maintainers; [ teutat3s ];
56 mainProgram = "mls";
57 };
58}