summary refs log tree commit diff
path: root/pkgs/servers/nosql/eventstore/default.nix
blob: 572cfe1f17d6e0ff0971d9ab1c8f72e748c5edce (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
{ stdenv, fetchFromGitHub, fetchpatch, mono, v8 }:

# There are some similarities with the pinta derivation. We should
# have a helper to make it easy to package these Mono apps.

stdenv.mkDerivation rec {
  name = "EventStore-${version}";
  version = "3.5.0";
  src = fetchFromGitHub {
    owner  = "EventStore";
    repo   = "EventStore";
    rev    = "oss-v${version}";
    sha256 = "0dp5914hxwdzw62q49wavqfqkw3jy0dvml09y7gh8frnbiajcxq9";
  };

  buildPhase = ''
    mkdir -p src/libs/x64/nixos
    pushd src/EventStore.Projections.v8Integration
    cc -o ../libs/x64/nixos/libjs1.so -fPIC -lv8 -shared -std=c++0x *.cpp
    popd

    patchShebangs build.sh
    ./build.sh ${version} release nixos
  '';

  installPhase = ''
    mkdir -p $out/{bin,lib/eventstore/clusternode}
    cp -r bin/clusternode/* $out/lib/eventstore/clusternode/
    cat > $out/bin/clusternode << EOF
    #!${stdenv.shell}
    exec ${mono}/bin/mono $out/lib/eventstore/clusternode/EventStore.ClusterNode.exe "\$@"
    EOF
    chmod +x $out/bin/clusternode
  '';

  buildInputs = [ v8 mono ];

  phases = [ "unpackPhase" "buildPhase" "installPhase" ];
  dontStrip = true;

  meta = {
    homepage = https://geteventstore.com/;
    description = "Event sourcing database with processing logic in JavaScript";
    license = stdenv.lib.licenses.bsd3;
    maintainers = with stdenv.lib.maintainers; [ puffnfresh ];
    platforms = [ "x86_64-linux" ];
  };
}