prl-tools: add package

+207
+8
pkgs/os-specific/linux/prl-tools/autostart.desktop
···
··· 1 + [Desktop Entry] 2 + Version=@version@ 3 + Encoding=UTF-8 4 + Name=@description@ 5 + Type=Application 6 + Exec=@exec@ 7 + X-KDE-autostart-phase=1 8 + GenericName[en_US]=
+197
pkgs/os-specific/linux/prl-tools/default.nix
···
··· 1 + { stdenv, lib, requireFile, makeWrapper, substituteAll, p7zip 2 + , gawk, utillinux, xorg, glib, dbus_glib, zlib 3 + , kernel ? null, libsOnly ? false 4 + }: 5 + 6 + assert (!libsOnly) -> kernel != null; 7 + 8 + let xorgFullVer = (builtins.parseDrvName xorg.xorgserver.name).version; 9 + xorgVer = lib.concatStringsSep "." (lib.take 2 (lib.splitString "." xorgFullVer)); 10 + x64 = if stdenv.system == "x86_64-linux" then true 11 + else if stdenv.system == "i686-linux" then false 12 + else abort "Parallels Tools for Linux only support {x86-64,i686}-linux targets"; 13 + # We autostart user services by ourselves, because prlcc uses hardcoded paths. 14 + autostart = [ { exec = "prlcc"; 15 + description = "Parallels Control Center"; 16 + } 17 + { exec = "prldhd"; 18 + description = "Parallels Control Center"; # not a mistake 19 + } 20 + { exec = "prl_wmouse_d"; 21 + description = "Parallels Walking Mouse Daemon"; 22 + } 23 + { exec = "prlcp"; 24 + description = "Parallels CopyPaste Tool"; 25 + } 26 + { exec = "prlsga"; 27 + description = "Parallels Shared Guest Applications Tool"; 28 + } 29 + { exec = "prlshprof"; 30 + description = "Parallels Shared Profile Tool"; 31 + } 32 + ]; 33 + in 34 + stdenv.mkDerivation rec { 35 + version = "10.0.2.27712"; 36 + name = "prl-tools-${version}"; 37 + 38 + src = requireFile rec { 39 + name = "prl-tools-lin.iso"; 40 + sha256 = "07960jvyv7gihjlg922znjm6db6l6bd23x9mg6ympwibzf2mylmx"; 41 + message = '' 42 + Please, place Parallel Tools for Linux image into Nix store 43 + using either 44 + nix-store --add-fixed sha256 ${name} 45 + or 46 + nix-prefetch-url file://path/to/${name} 47 + ''; 48 + }; 49 + 50 + # also maybe python2 to generate xorg.conf 51 + nativeBuildInputs = [ p7zip ] ++ lib.optionals (!libsOnly) [ makeWrapper ]; 52 + 53 + inherit libsOnly; 54 + 55 + unpackPhase = '' 56 + 7z x $src 57 + export sourceRoot=. 58 + if test -z "$libsOnly"; then 59 + ( cd kmods; tar -xaf prl_mod.tar.gz ) 60 + fi 61 + ( cd tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz ) 62 + ''; 63 + 64 + kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version; 65 + kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}"; 66 + scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]); 67 + 68 + buildPhase = '' 69 + if test -z "$libsOnly"; then 70 + ( # kernel modules 71 + cd kmods 72 + make -f Makefile.kmods \ 73 + KSRC=$kernelDir/source \ 74 + HEADERS_CHECK_DIR=$kernelDir/source \ 75 + KERNEL_DIR=$kernelDir/build \ 76 + SRC=$kernelDir/build \ 77 + KVER=$kernelVersion 78 + ) 79 + 80 + # Xorg config (maybe would be useful for other versions) 81 + #python2 installer/xserver-config.py xorg ${xorgVer} /dev/null parallels.conf 82 + fi 83 + ''; 84 + 85 + libPath = with xorg; 86 + stdenv.lib.makeLibraryPath ([ stdenv.gcc.gcc libXrandr libXext libX11 libXcomposite libXinerama ] 87 + ++ lib.optionals (!libsOnly) [ libXi glib dbus_glib zlib ]); 88 + 89 + desktops = map (x: substituteAll ({ 90 + src = ./autostart.desktop; 91 + name = x.exec + ".desktop"; 92 + version = version; 93 + } // x)) autostart; 94 + 95 + installPhase = '' 96 + if test -z "$libsOnly"; then 97 + ( # kernel modules 98 + cd kmods 99 + mkdir -p $out/lib/modules/${kernelVersion}/extra 100 + cp prl_eth/pvmnet/prl_eth.ko $out/lib/modules/${kernelVersion}/extra 101 + cp prl_tg/Toolgate/Guest/Linux/prl_tg/prl_tg.ko $out/lib/modules/${kernelVersion}/extra 102 + cp prl_fs/SharedFolders/Guest/Linux/prl_fs/prl_fs.ko $out/lib/modules/${kernelVersion}/extra 103 + cp prl_fs_freeze/Snapshot/Guest/Linux/prl_freeze/prl_fs_freeze.ko $out/lib/modules/${kernelVersion}/extra 104 + ) 105 + fi 106 + 107 + ( # tools 108 + cd tools 109 + mkdir -p $out/lib 110 + 111 + if test -z "$libsOnly"; then 112 + # install binaries 113 + for i in bin/* sbin/prl_nettool sbin/prl_snapshot; do 114 + install -Dm755 $i $out/$i 115 + done 116 + # other binaries 117 + for i in xorg.7.1/usr/bin/*; do 118 + cp $i $out/bin 119 + done 120 + 121 + for i in $out/bin/* $out/sbin/*; do 122 + patchelf \ 123 + --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ 124 + --set-rpath "$out/lib:$libPath" \ 125 + $i 126 + done 127 + 128 + mkdir -p $out/bin 129 + install -Dm755 ../installer/prlfsmountd.sh $out/sbin/prlfsmountd 130 + wrapProgram $out/sbin/prlfsmountd \ 131 + --prefix PATH ':' "$scriptPath" 132 + 133 + for i in lib/*.a; do 134 + cp $i $out/lib 135 + done 136 + 137 + for i in xorg.7.1/usr/lib/libprl_wmouse_watcher.*; do 138 + cp $i $out/lib 139 + done 140 + 141 + mkdir -p $out/lib/udev/rules.d 142 + for i in *.rules; do 143 + sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i 144 + done 145 + 146 + mkdir -p $out/share/autostart 147 + for i in $desktops; do 148 + cat $i | sed "s,^Exec=,Exec=$out/bin/," > $out/share/autostart/$(basename $i) 149 + done 150 + 151 + ( 152 + cd xorg.${xorgVer} 153 + # Install the X modules. 154 + ( 155 + cd x-server/modules 156 + for i in */*; do 157 + install -Dm755 $i $out/lib/xorg/modules/$i 158 + done 159 + ) 160 + ( 161 + cd usr/lib 162 + libGLXname=$(echo libglx.so*) 163 + install -Dm755 $libGLXname $out/lib/xorg/modules/extensions/$libGLXname 164 + ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so 165 + ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so.1 166 + ) 167 + ) 168 + fi 169 + 170 + for i in xorg.7.1/usr/lib/libGL.*; do 171 + cp $i $out/lib 172 + done 173 + 174 + cd $out 175 + find -name \*.so\* -type f -exec \ 176 + patchelf --set-rpath "$out/lib:$libPath" {} \; 177 + 178 + cd lib 179 + libGLname=$(echo libGL.so*) 180 + ln -s $libGLname libGL.so 181 + ln -s $libGLname libGL.so.1 182 + ) 183 + ''; 184 + 185 + dontStrip = true; 186 + dontPatchELF = true; 187 + 188 + meta = with stdenv.lib; { 189 + description = "Parallels Tools for Linux guests"; 190 + homepage = http://parallels.com; 191 + platforms = platforms.linux; 192 + license = licenses.unfree; 193 + # I was making this package blindly and requesting testing from the real user, 194 + # so I can't even test it by myself and won't provide future updates. 195 + maintainers = with maintainers; [ abbradar ]; 196 + }; 197 + }
+2
pkgs/top-level/all-packages.nix
··· 8290 8291 perf = callPackage ../os-specific/linux/kernel/perf.nix { }; 8292 8293 psmouse_alps = callPackage ../os-specific/linux/psmouse-alps { }; 8294 8295 seturgent = callPackage ../os-specific/linux/seturgent { };
··· 8290 8291 perf = callPackage ../os-specific/linux/kernel/perf.nix { }; 8292 8293 + prl-tools = callPackage ../os-specific/linux/prl-tools { }; 8294 + 8295 psmouse_alps = callPackage ../os-specific/linux/psmouse-alps { }; 8296 8297 seturgent = callPackage ../os-specific/linux/seturgent { };