Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 106 lines 2.5 kB view raw
1{ 2 autoPatchelfHook, 3 fetchurl, 4 gcc-unwrapped, 5 gsettings-desktop-schemas, 6 gtk3, 7 lib, 8 libGL, 9 makeDesktopItem, 10 makeWrapper, 11 nwjs, 12 stdenv, 13 unzip, 14 udev, 15 wrapGAppsHook3, 16 copyDesktopItems, 17}: 18 19stdenv.mkDerivation rec { 20 pname = "popcorntime"; 21 version = "0.5.1"; 22 23 src = fetchurl { 24 url = "https://github.com/popcorn-official/popcorn-desktop/releases/download/v${version}/Popcorn-Time-${version}-linux64.zip"; 25 hash = "sha256-lCsIioR252GWP/+wNwkTw5PLSal/M9x6mlR/EKOd/hs="; 26 }; 27 28 nativeBuildInputs = [ 29 autoPatchelfHook 30 makeWrapper 31 unzip 32 wrapGAppsHook3 33 copyDesktopItems 34 ]; 35 36 buildInputs = [ 37 gcc-unwrapped 38 gsettings-desktop-schemas 39 gtk3 40 nwjs 41 udev 42 ]; 43 44 sourceRoot = "."; 45 46 dontWrapGApps = true; 47 dontUnpack = true; 48 49 makeWrapperArgs = [ 50 "--prefix LD_LIBRARY_PATH : ${ 51 lib.makeLibraryPath [ 52 gcc-unwrapped.lib 53 gtk3 54 udev 55 libGL 56 ] 57 }" 58 "--prefix PATH : ${lib.makeBinPath [ stdenv.cc ]}" 59 ]; 60 61 desktopItem = makeDesktopItem { 62 name = pname; 63 exec = pname; 64 icon = pname; 65 comment = meta.description; 66 genericName = meta.description; 67 type = "Application"; 68 desktopName = "Popcorn-Time"; 69 categories = [ 70 "Video" 71 "AudioVideo" 72 ]; 73 }; 74 75 # Extract and copy executable in $out/bin 76 installPhase = '' 77 mkdir -p $out/share/applications $out/bin $out/opt/bin $out/share/icons/hicolor/scalable/apps/ 78 # we can't unzip it in $out/lib, because nw.js will start with 79 # an empty screen. Therefore it will be unzipped in a non-typical 80 # folder and symlinked. 81 unzip -q $src -d $out/opt/popcorntime 82 83 ln -s $out/opt/popcorntime/Popcorn-Time $out/bin/popcorntime 84 85 ln -s $out/opt/popcorntime/src/app/images/icon.png $out/share/icons/hicolor/scalable/apps/popcorntime.png 86 87 ln -s ${desktopItem}/share/applications/popcorntime.desktop $out/share/applications/popcorntime.desktop 88 ''; 89 90 # GSETTINGS_SCHEMAS_PATH is not set in installPhase 91 preFixup = '' 92 wrapProgram $out/bin/popcorntime \ 93 ''${makeWrapperArgs[@]} \ 94 ''${gappsWrapperArgs[@]} 95 ''; 96 97 meta = with lib; { 98 homepage = "https://github.com/popcorn-official/popcorn-desktop"; 99 description = "Application that streams movies and TV shows from torrents"; 100 platforms = [ "x86_64-linux" ]; 101 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 102 license = lib.licenses.gpl3; 103 maintainers = with maintainers; [ onny ]; 104 mainProgram = "popcorntime"; 105 }; 106}