@@ -1,6 +1,7 @@
11{ stdenv, lib, requireFile, makeWrapper, substituteAll, p7zip
22, gawk, utillinux, xorg, glib, dbus_glib, zlib
33, kernel ? null, libsOnly ? false
4+, undmg, fetchurl
45}:
56
67assert (!libsOnly) -> kernel != null;
@@ -10,57 +11,35 @@ let xorgFullVer = (builtins.parseDrvName xorg.xorgserver.name).version;
1011 x64 = if stdenv.system == "x86_64-linux" then true
1112 else if stdenv.system == "i686-linux" then false
1213 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− ];
3314in
3415stdenv.mkDerivation rec {
35− version = "10.0.2.27712";
16+ version = "${prl_major}.2.1-41615";
17+ prl_major = "12";
3618 name = "prl-tools-${version}";
3719
38− src = requireFile rec {
39− name = "prl-tools-lin.iso";
40− sha256 = "07960jvyv7gihjlg922znjm6db6l6bd23x9mg6ympwibzf2mylmx";
41− message = ''
42− Please, place Parallels 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− '';
20+ # We download the full distribution to extract prl-tools-lin.iso from
21+ # => ${dmg}/Parallels\ Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso
22+ src = fetchurl {
23+ url = "https://download.parallels.com/desktop/v${prl_major}/${version}/ParallelsDesktop-${version}.dmg";
24+ sha256 = "1jwzwif69qlhmfky9kigjaxpxfj0lyrl1iyrpqy4iwqvajdgbbym";
4825 };
4926
50− hardeningDisable = [ "pic" ];
27+ hardeningDisable = [ "pic" "format" ];
5128
5229 # also maybe python2 to generate xorg.conf
53− nativeBuildInputs = [ p7zip ] ++ lib.optionals (!libsOnly) [ makeWrapper ];
30+ nativeBuildInputs = [ p7zip undmg ] ++ lib.optionals (!libsOnly) [ makeWrapper ];
5431
5532 inherit libsOnly;
5633
5734 unpackPhase = ''
58− 7z x $src
59− export sourceRoot=.
35+ undmg < "${src}"
36+
37+ export sourceRoot=prl-tools-build
38+ 7z x "Parallels Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso" -o$sourceRoot
6039 if test -z "$libsOnly"; then
61− ( cd kmods; tar -xaf prl_mod.tar.gz )
40+ ( cd $sourceRoot/kmods; tar -xaf prl_mod.tar.gz )
6241 fi
63− ( cd tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
42+ ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
6443 '';
6544
6645 kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version;
@@ -88,11 +67,6 @@ stdenv.mkDerivation rec {
8867 stdenv.lib.makeLibraryPath ([ stdenv.cc.cc libXrandr libXext libX11 libXcomposite libXinerama ]
8968 ++ lib.optionals (!libsOnly) [ libXi glib dbus_glib zlib ]);
9069
91− desktops = map (x: substituteAll ({
92− src = ./autostart.desktop;
93− name = x.exec + ".desktop";
94− version = version;
95− } // x)) autostart;
9670
9771 installPhase = ''
9872 if test -z "$libsOnly"; then
@@ -124,7 +98,7 @@ stdenv.mkDerivation rec {
12498 patchelf \
12599 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
126100 --set-rpath "$out/lib:$libPath" \
127− $i
101+ $i || true
128102 done
129103
130104 mkdir -p $out/bin
@@ -145,11 +119,6 @@ stdenv.mkDerivation rec {
145119 sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i
146120 done
147121
148− mkdir -p $out/share/autostart
149− for i in $desktops; do
150− cat $i | sed "s,^Exec=,Exec=$out/bin/," > $out/share/autostart/$(basename $i)
151− done
152−
153122 (
154123 cd xorg.${xorgVer}
155124 # Install the X modules.
@@ -189,8 +158,8 @@ stdenv.mkDerivation rec {
189158
190159 meta = with stdenv.lib; {
191160 description = "Parallels Tools for Linux guests";
192− homepage = http://parallels.com;
193− platforms = platforms.linux;
161+ homepage = https://parallels.com;
162+ platforms = [ "i686-linux" "x86_64-linux" ];
194163 license = licenses.unfree;
195164 # I was making this package blindly and requesting testing from the real user,
196165 # so I can't even test it by myself and won't provide future updates.