1{
2 stdenv,
3 lib,
4 fetchurl,
5 fetchFromGitHub,
6 autoPatchelfHook,
7 makeWrapper,
8 libcxx,
9 libX11,
10 libXt,
11 libXdamage,
12 glib,
13 gtk3,
14 dbus-glib,
15 openssl,
16 nodejs,
17 zlib,
18 fetchzip,
19}:
20let
21 metadata = lib.importJSON ./meta.json;
22in
23rec {
24 replay-recordreplay = stdenv.mkDerivation {
25 pname = "replay-recordreplay";
26 version = builtins.head (builtins.match ".*/linux-recordreplay-(.*).tgz" metadata.recordreplay.url);
27 nativeBuildInputs = [ autoPatchelfHook ];
28 buildInputs = [
29 (lib.getLib stdenv.cc.cc)
30 openssl
31 zlib
32 ];
33
34 src = (fetchzip metadata.recordreplay);
35 dontBuild = true;
36 installPhase = ''
37 runHook preInstall
38 cp linux-recordreplay.so $out
39 runHook postInstall
40 '';
41 postFixup = ''
42 patchelf --set-rpath "$(patchelf --print-rpath $out):${lib.makeLibraryPath [ openssl ]}" $out
43 '';
44 meta = with lib; {
45 description = "RecordReplay internal recording library";
46 homepage = "https://www.replay.io/";
47 license = lib.licenses.unfree;
48 maintainers = with maintainers; [ phryneas ];
49 platforms = [ "x86_64-linux" ];
50 };
51 };
52
53 replay-io = stdenv.mkDerivation rec {
54 pname = "replay-io";
55 version = builtins.head (builtins.match ".*/linux-gecko-(.*).tar.bz2" metadata.replay.url);
56 srcs = fetchurl metadata.replay;
57 nativeBuildInputs = [
58 autoPatchelfHook
59 makeWrapper
60 ];
61 buildInputs = [
62 dbus-glib
63 glib
64 gtk3
65 libX11
66 libXdamage
67 libXt
68 ];
69 installPhase = ''
70 runHook preInstall
71 mkdir -p $out/opt/replay-io
72 cp -r * $out/opt/replay-io
73 mkdir $out/bin
74 makeWrapper $out/opt/replay-io/replay \
75 $out/bin/replay-io \
76 --set "RECORD_REPLAY_DRIVER" "${replay-recordreplay}"
77 runHook postInstall
78 '';
79
80 passthru.updateScript = ./update.sh;
81
82 meta = with lib; {
83 description = "Time Travel Debugger for Web Development";
84 longDescription = ''
85 Replay allows you to record and replay web applications with familiar browser dev tools.
86 You can access the browser DevTools at any point of the recording, adding new logger
87 statements and inspecting the status of the DOM, variables and the current call stack.
88 Your recordings can be shared with other users for collaborative debugging.
89 '';
90 homepage = "https://www.replay.io/";
91 downloadPage = "https://www.replay.io/";
92 mainProgram = "replay-io";
93 license = lib.licenses.mpl20;
94 maintainers = with maintainers; [ phryneas ];
95 platforms = [ "x86_64-linux" ];
96 };
97 };
98
99 replay-node = stdenv.mkDerivation rec {
100 pname = "replay-node";
101 version = builtins.head (builtins.match ".*/linux-node-(.*)" metadata.replay-node.url);
102 nativeBuildInputs = [
103 autoPatchelfHook
104 makeWrapper
105 ];
106 buildInputs = [ (lib.getLib stdenv.cc.cc) ];
107
108 src = (fetchurl metadata.replay-node);
109 dontUnpack = true;
110 dontBuild = true;
111 installPhase = ''
112 runHook preInstall
113 mkdir -p $out/bin $out/opt/replay-node
114 cp $src $out/opt/replay-node/node-unwrapped
115 chmod +x $out/opt/replay-node/node-unwrapped
116
117 makeWrapper $out/opt/replay-node/node-unwrapped \
118 $out/opt/replay-node/node \
119 --set "RECORD_REPLAY_DRIVER" "${replay-recordreplay}"
120
121 ln -s $out/opt/replay-node/node $out/bin/replay-node
122 runHook postInstall
123 '';
124
125 meta = with lib; {
126 description = "Event-driven I/O framework for the V8 JavaScript engine, patched for replay";
127 homepage = "https://github.com/RecordReplay/node";
128 license = licenses.mit;
129 maintainers = with maintainers; [ phryneas ];
130 platforms = platforms.linux;
131 mainProgram = "replay-node";
132 };
133 };
134
135 replay-node-cli = stdenv.mkDerivation {
136 pname = "replay-node-cli";
137 version = "0.1.7-" + builtins.head (builtins.match ".*/linux-node-(.*)" metadata.replay-node.url);
138 src = fetchFromGitHub {
139 owner = "RecordReplay";
140 repo = "replay-node-cli";
141 rev = "5269c8b8e7c5c7a9618a68f883d19c11a68be837";
142 sha256 = "04d22q3dvs9vxpb9ps64pdxq9ziwgvnzdgsn6p9p0lzjagh0f5n0";
143 };
144
145 nativeBuildInputs = [ makeWrapper ];
146 buildInputs = [
147 (lib.getLib stdenv.cc.cc)
148 nodejs
149 ];
150 dontBuild = true;
151 installPhase = ''
152 runHook preInstall
153 mkdir -p $out/opt/replay-node-cli
154 cp -r * $out/opt/replay-node-cli
155 makeWrapper $out/opt/replay-node-cli/bin/replay-node \
156 $out/bin/replay-node \
157 --prefix "PATH" ":" "${nodejs}/bin" \
158 --set "RECORD_REPLAY_NODE_DIRECTORY" "${replay-node}/opt/replay-node"
159 runHook postInstall
160 '';
161
162 meta = with lib; {
163 description = "Time Travel Debugger for Web Development - Node Command Line";
164 longDescription = ''
165 The Replay Node Command Line allows you to record node applications and debug them
166 with familiar browser dev tools.
167 You can access the browser DevTools at any point of the recording, adding new logger
168 statements and inspecting the status of variables and the current call stack.
169 Your recordings can be shared with other users for collaborative debugging.
170 '';
171 homepage = "https://www.replay.io/";
172 mainProgram = "replay-node";
173 license = lib.licenses.bsd3;
174 maintainers = with maintainers; [ phryneas ];
175 platforms = [ "x86_64-linux" ];
176 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
177 };
178 };
179}