lol
1{ stdenv, lib, fetchurl, dpkg, patchelf, qt4, libXtst, libXext, libX11, makeWrapper, libXScrnSaver }:
2
3let
4 src =
5 if stdenv.system == "i686-linux" then fetchurl {
6 name = "rescuetime-installer.deb";
7 url = "https://www.rescuetime.com/installers/rescuetime_current_i386.deb";
8 sha256 = "15x3nvhxk4f0rga0i99c6lhaa1rwdi446kxnx1l4jprhbl788sx6";
9 } else fetchurl {
10 name = "rescuetime-installer.deb";
11 url = "https://www.rescuetime.com/installers/rescuetime_current_amd64.deb";
12 sha256 = "0ibdlx8fdlmh81908d1syb7c5lf88pqp49fl7r43cj6bybpdx411";
13 };
14
15in
16
17stdenv.mkDerivation {
18 # https://www.rescuetime.com/updates/linux_release_notes.html
19 name = "rescuetime-2.8.9.1170";
20 inherit src;
21 buildInputs = [ dpkg makeWrapper ];
22 unpackPhase = ''
23 mkdir pkg
24 dpkg-deb -x $src pkg
25 sourceRoot=pkg
26 '';
27 installPhase = ''
28 mkdir -p $out/bin
29 cp usr/bin/rescuetime $out/bin
30
31 ${patchelf}/bin/patchelf \
32 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
33 $out/bin/rescuetime
34
35 wrapProgram $out/bin/rescuetime \
36 --prefix LD_PRELOAD : ${qt4}/lib/libQtGui.so.4:${qt4}/lib/libQtCore.so.4:${libXtst}/lib/libXtst.so.6:${libXext}/lib/libXext.so.6:${libX11}/lib/libX11.so.6:${libXScrnSaver}/lib/libXss.so.1
37 '';
38 meta = with lib; {
39 description = "Helps you understand your daily habits so you can focus and be more productive";
40 homepage = "https://www.rescuetime.com";
41 maintainers = with maintainers; [ cstrahan ];
42 license = licenses.unfree;
43 platforms = [ "i686-linux" "x86_64-linux" ];
44 };
45}