lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 18.09-beta 170 lines 5.7 kB view raw
1{ stdenv, lib, makeWrapper, p7zip 2, gawk, utillinux, xorg, glib, dbus-glib, zlib 3, kernel ? null, libsOnly ? false 4, undmg, fetchurl 5}: 6 7assert (!libsOnly) -> kernel != null; 8# Disable for kernels 4.15 and above due to compatibility issues 9assert kernel != null -> stdenv.lib.versionOlder kernel.version "4.15"; 10 11let xorgFullVer = (builtins.parseDrvName xorg.xorgserver.name).version; 12 xorgVer = lib.concatStringsSep "." (lib.take 2 (lib.splitString "." xorgFullVer)); 13 x64 = if stdenv.hostPlatform.system == "x86_64-linux" then true 14 else if stdenv.hostPlatform.system == "i686-linux" then false 15 else throw "Parallels Tools for Linux only support {x86-64,i686}-linux targets"; 16in 17stdenv.mkDerivation rec { 18 version = "${prl_major}.2.1-41615"; 19 prl_major = "12"; 20 name = "prl-tools-${version}"; 21 22 # We download the full distribution to extract prl-tools-lin.iso from 23 # => ${dmg}/Parallels\ Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso 24 src = fetchurl { 25 url = "https://download.parallels.com/desktop/v${prl_major}/${version}/ParallelsDesktop-${version}.dmg"; 26 sha256 = "1jwzwif69qlhmfky9kigjaxpxfj0lyrl1iyrpqy4iwqvajdgbbym"; 27 }; 28 29 hardeningDisable = [ "pic" "format" ]; 30 31 # also maybe python2 to generate xorg.conf 32 nativeBuildInputs = [ p7zip undmg ] ++ lib.optionals (!libsOnly) [ makeWrapper ] ++ kernel.moduleBuildDependencies; 33 34 inherit libsOnly; 35 36 unpackPhase = '' 37 undmg < "${src}" 38 39 export sourceRoot=prl-tools-build 40 7z x "Parallels Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso" -o$sourceRoot 41 if test -z "$libsOnly"; then 42 ( cd $sourceRoot/kmods; tar -xaf prl_mod.tar.gz ) 43 fi 44 ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz ) 45 ''; 46 47 kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version; 48 kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}"; 49 scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]); 50 51 buildPhase = '' 52 if test -z "$libsOnly"; then 53 ( # kernel modules 54 cd kmods 55 make -f Makefile.kmods \ 56 KSRC=$kernelDir/source \ 57 HEADERS_CHECK_DIR=$kernelDir/source \ 58 KERNEL_DIR=$kernelDir/build \ 59 SRC=$kernelDir/build \ 60 KVER=$kernelVersion 61 ) 62 63 # Xorg config (maybe would be useful for other versions) 64 #python2 installer/xserver-config.py xorg ${xorgVer} /dev/null parallels.conf 65 fi 66 ''; 67 68 libPath = with xorg; 69 stdenv.lib.makeLibraryPath ([ stdenv.cc.cc libXrandr libXext libX11 libXcomposite libXinerama ] 70 ++ lib.optionals (!libsOnly) [ libXi glib dbus-glib zlib ]); 71 72 73 installPhase = '' 74 if test -z "$libsOnly"; then 75 ( # kernel modules 76 cd kmods 77 mkdir -p $out/lib/modules/${kernelVersion}/extra 78 cp prl_eth/pvmnet/prl_eth.ko $out/lib/modules/${kernelVersion}/extra 79 cp prl_tg/Toolgate/Guest/Linux/prl_tg/prl_tg.ko $out/lib/modules/${kernelVersion}/extra 80 cp prl_fs/SharedFolders/Guest/Linux/prl_fs/prl_fs.ko $out/lib/modules/${kernelVersion}/extra 81 cp prl_fs_freeze/Snapshot/Guest/Linux/prl_freeze/prl_fs_freeze.ko $out/lib/modules/${kernelVersion}/extra 82 ) 83 fi 84 85 ( # tools 86 cd tools 87 mkdir -p $out/lib 88 89 if test -z "$libsOnly"; then 90 # install binaries 91 for i in bin/* sbin/prl_nettool sbin/prl_snapshot; do 92 install -Dm755 $i $out/$i 93 done 94 # other binaries 95 for i in xorg.7.1/usr/bin/*; do 96 cp $i $out/bin 97 done 98 99 for i in $out/bin/* $out/sbin/*; do 100 patchelf \ 101 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 102 --set-rpath "$out/lib:$libPath" \ 103 $i || true 104 done 105 106 mkdir -p $out/bin 107 install -Dm755 ../installer/prlfsmountd.sh $out/sbin/prlfsmountd 108 wrapProgram $out/sbin/prlfsmountd \ 109 --prefix PATH ':' "$scriptPath" 110 111 for i in lib/*.a; do 112 cp $i $out/lib 113 done 114 115 for i in xorg.7.1/usr/lib/libprl_wmouse_watcher.*; do 116 cp $i $out/lib 117 done 118 119 mkdir -p $out/lib/udev/rules.d 120 for i in *.rules; do 121 sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i 122 done 123 124 ( 125 cd xorg.${xorgVer} 126 # Install the X modules. 127 ( 128 cd x-server/modules 129 for i in */*; do 130 install -Dm755 $i $out/lib/xorg/modules/$i 131 done 132 ) 133 ( 134 cd usr/lib 135 libGLXname=$(echo libglx.so*) 136 install -Dm755 $libGLXname $out/lib/xorg/modules/extensions/$libGLXname 137 ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so 138 ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so.1 139 ) 140 ) 141 fi 142 143 for i in xorg.7.1/usr/lib/libGL.*; do 144 cp $i $out/lib 145 done 146 147 cd $out 148 find -name \*.so\* -type f -exec \ 149 patchelf --set-rpath "$out/lib:$libPath" {} \; 150 151 cd lib 152 libGLname=$(echo libGL.so*) 153 ln -s $libGLname libGL.so 154 ln -s $libGLname libGL.so.1 155 ) 156 ''; 157 158 dontStrip = true; 159 dontPatchELF = true; 160 161 meta = with stdenv.lib; { 162 description = "Parallels Tools for Linux guests"; 163 homepage = https://parallels.com; 164 platforms = [ "i686-linux" "x86_64-linux" ]; 165 license = licenses.unfree; 166 # I was making this package blindly and requesting testing from the real user, 167 # so I can't even test it by myself and won't provide future updates. 168 maintainers = with maintainers; [ abbradar ]; 169 }; 170}