about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/admin/manta/default.nix
blob: ef0d92150360b754b1ae96f5e83ea6af81a6b0e2 (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
{ lib
, buildNpmPackage
, fetchFromGitHub
, installShellFiles
, testers
, node-manta
}:

buildNpmPackage rec {
  pname = "manta";
  version = "5.4.2";

  src = fetchFromGitHub {
    owner = "TritonDataCenter";
    repo = "node-manta";
    rev = "v${version}";
    hash = "sha256-Uj3fNzeERiO++sW2uyAbtfN/1Ed6uRVBBvCecncq/QY=";
  };

  npmDepsHash = "sha256-Xk/K90K+X73ZTV6u2GJij8815GdBn6igXmpWLaCfKF4=";

  dontBuild = true;

  nativeBuildInputs = [ installShellFiles ];

  postInstall = ''
    ln -s ./lib/node_modules/manta/bin $out/bin
  '';

  postFixup = ''
    # create completions, following upstream procedure https://github.com/joyent/node-manta/blob/v5.4.1/Makefile#L85-L91
    cmds=$(find ./bin/ -type f -printf "%f\n")

    node $out/lib/node_modules/manta/lib/create_client.js

    for cmd in $cmds; do
      installShellCompletion --cmd $cmd --bash <($out/bin/$cmd --completion)

      # Strip timestamp from generated bash completion
      sed -i '/Bash completion generated.*/d' $out/share/bash-completion/completions/$cmd.bash
    done
  '';

  passthru = {
    tests.version = testers.testVersion {
      package = node-manta;
    };
  };

  meta = with lib; {
    description = "Manta Object-Storage Client CLIs and Node.js SDK";
    homepage = "https://github.com/TritonDataCenter/node-manta";
    changelog = "https://github.com/TritonDataCenter/node-manta/blob/v${version}/CHANGES.md";
    license = licenses.mit;
    maintainers = with maintainers; [ teutat3s ];
    mainProgram = "mls";
  };
}