aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/servers/nosql/riak-cs/2.1.1.nix
blob: 4ebcbafde5dcce63f415ef13e4d5303bef640f9f (plain)
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
68
69
70
{ stdenv, lib, fetchurl, unzip, erlang, git, wget, which, pam
, Carbon ? null, Cocoa ? null }:

stdenv.mkDerivation {
  name = "riak_cs-2.1.1";

  buildInputs = [
    which unzip erlang git wget
  ] ++ lib.optionals stdenv.isDarwin [ Carbon Cocoa ]
    ++ lib.optional stdenv.isLinux [ pam ];

  src = fetchurl {
    url = "https://s3.amazonaws.com/downloads.basho.com/riak-cs/2.1/2.1.1/riak-cs-2.1.1.tar.gz";
    sha256 = "115cac127aac6d759c1b429a52e0d18e491c0719a6530b1b88aa52c4efdbedd5";
  };


  postPatch = ''
    sed -i deps/node_package/priv/base/env.sh \
      -e 's@{{platform_data_dir}}@''${RIAK_DATA_DIR:-/var/db/riak-cs}@' \
      -e 's@^RUNNER_SCRIPT_DIR=.*@RUNNER_SCRIPT_DIR='$out'/bin@' \
      -e 's@^RUNNER_BASE_DIR=.*@RUNNER_BASE_DIR='$out'@' \
      -e 's@^RUNNER_ETC_DIR=.*@RUNNER_ETC_DIR=''${RIAK_ETC_DIR:-/etc/riak-cs}@' \
      -e 's@^RUNNER_LOG_DIR=.*@RUNNER_LOG_DIR=''${RIAK_LOG_DIR:-/var/log}@'

    sed -i ./Makefile \
      -e 's@rel: deps compile@rel: deps compile-src@'
  '';

  preBuild = ''
    patchShebangs .
  '';

  buildPhase = ''
    runHook preBuild

    make locked-deps
    make rel

    runHook postBuild
  '';

  doCheck = false;

  installPhase = ''
    runHook preInstall

    mkdir $out
    mv rel/riak-cs/etc rel/riak-cs/riak-etc
    mkdir -p rel/riak-cs/etc
    mv rel/riak-cs/riak-etc rel/riak-cs/etc/riak-cs
    mv rel/riak-cs/* $out

    for prog in $out/bin/*; do
      substituteInPlace $prog \
        --replace '. "`cd \`dirname $0\` && /bin/pwd`/../lib/env.sh"' \
                  ". $out/lib/env.sh"
    done

    runHook postInstall
  '';

  meta = with lib; {
    description = "Dynamo inspired NoSQL DB by Basho with S3 compatibility";
    platforms   = [ "x86_64-linux" "x86_64-darwin" ];
    license     = licenses.asl20;
    maintainers = with maintainers; [ mdaiter ];
    knownVulnerabilities = [ "CVE-2017-3163 - see https://github.com/NixOS/nixpkgs/issues/33876" ];
  };
}