nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 90 lines 2.3 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 dpkg, 6 patchelf, 7 qt5, 8 libXtst, 9 libXext, 10 libX11, 11 mkDerivation, 12 libXScrnSaver, 13 writeScript, 14 common-updater-scripts, 15 curl, 16 pup, 17}: 18 19let 20 version = "2.16.5.1"; 21 src = 22 if stdenv.hostPlatform.system == "i686-linux" then 23 fetchurl { 24 name = "rescuetime-installer.deb"; 25 url = "https://www.rescuetime.com/installers/rescuetime_${version}_i386.deb"; 26 sha256 = "1xrvyy0higc1fbc8ascpaszvg2bl6x0a35bzmdq6dkay48hnrd8b"; 27 } 28 else 29 fetchurl { 30 name = "rescuetime-installer.deb"; 31 url = "https://www.rescuetime.com/installers/rescuetime_${version}_amd64.deb"; 32 sha256 = "09ng0yal66d533vzfv27k9l2va03rqbqmsni43qi3hgx7w9wx5ii"; 33 }; 34in 35mkDerivation rec { 36 # https://www.rescuetime.com/updates/linux_release_notes.html 37 inherit version; 38 pname = "rescuetime"; 39 inherit src; 40 nativeBuildInputs = [ dpkg ]; 41 # avoid https://github.com/NixOS/patchelf/issues/99 42 dontStrip = true; 43 44 installPhase = '' 45 mkdir -p $out/bin 46 cp usr/bin/rescuetime $out/bin 47 48 ${patchelf}/bin/patchelf \ 49 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 50 --set-rpath "${ 51 lib.makeLibraryPath [ 52 qt5.qtbase 53 libXtst 54 libXext 55 libX11 56 libXScrnSaver 57 ] 58 }" \ 59 $out/bin/rescuetime 60 ''; 61 62 passthru.updateScript = writeScript "${pname}-updater" '' 63 #!${stdenv.shell} 64 set -eu -o pipefail 65 PATH=${ 66 lib.makeBinPath [ 67 curl 68 pup 69 common-updater-scripts 70 ] 71 }:$PATH 72 latestVersion="$(curl -sS https://www.rescuetime.com/release-notes/linux | pup '.release:first-of-type h2 strong text{}' | tr -d '\n')" 73 74 for platform in ${lib.concatStringsSep " " meta.platforms}; do 75 update-source-version ${pname} "$latestVersion" --system=$platform --ignore-same-version 76 done 77 ''; 78 79 meta = with lib; { 80 description = "Helps you understand your daily habits so you can focus and be more productive"; 81 homepage = "https://www.rescuetime.com"; 82 maintainers = [ ]; 83 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 84 license = licenses.unfree; 85 platforms = [ 86 "i686-linux" 87 "x86_64-linux" 88 ]; 89 }; 90}