about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-11-23 14:10:21 +0000
committerGitHub <noreply@github.com>2017-11-23 14:10:21 +0000
commit487c4a6f6eea808117edb993dfcfc4504da86bce (patch)
treec00aeeae21965af7f035a6accdfdb2d029a4078c
parenta30fa6d9a255288a4f8a1ca77a058bf650ed75ee (diff)
parent2ce30c5b5303e7a4a991bc852669d13d31823c82 (diff)
Merge pull request #27513 from lukeadams/prl-tools-fix
[NixOS] Fix + update `hardware.parallels` config option
-rw-r--r--nixos/modules/virtualisation/parallels-guest.nix48
-rw-r--r--pkgs/os-specific/linux/prl-tools/default.nix69
2 files changed, 65 insertions, 52 deletions
diff --git a/nixos/modules/virtualisation/parallels-guest.nix b/nixos/modules/virtualisation/parallels-guest.nix
index bd85973ee5610..fc0409e9ec770 100644
--- a/nixos/modules/virtualisation/parallels-guest.nix
+++ b/nixos/modules/virtualisation/parallels-guest.nix
@@ -27,7 +27,6 @@ in
   };
 
   config = mkIf config.hardware.parallels.enable {
-
     services.xserver = {
       drivers = singleton
         { name = "prlvideo"; modules = [ prl-tools ]; libPath = [ prl-tools ]; };
@@ -55,7 +54,7 @@ in
 
     boot.extraModulePackages = [ prl-tools ];
 
-    boot.kernelModules = [ "prl_tg" "prl_eth" "prl_fs" "prl_fs_freeze" "acpi_memhotplug" ];
+    boot.kernelModules = [ "prl_tg" "prl_eth" "prl_fs" "prl_fs_freeze" ];
 
     services.timesyncd.enable = false;
 
@@ -89,5 +88,50 @@ in
       };
     };
 
+    systemd.user.services = {
+      prlcc = {
+        description = "Parallels Control Center";
+        wantedBy = [ "graphical-session.target" ];
+        serviceConfig = {
+          ExecStart = "${prl-tools}/bin/prlcc";
+        };
+      };
+      prldnd = {
+        description = "Parallels Control Center";
+        wantedBy = [ "graphical-session.target" ];
+        serviceConfig = {
+          ExecStart = "${prl-tools}/bin/prldnd";
+        };
+      };
+      prl_wmouse_d  = {
+        description = "Parallels Walking Mouse Daemon";
+        wantedBy = [ "graphical-session.target" ];
+        serviceConfig = {
+          ExecStart = "${prl-tools}/bin/prl_wmouse_d";
+        };
+      };
+      prlcp = {
+        description = "Parallels CopyPaste Tool";
+        wantedBy = [ "graphical-session.target" ];
+        serviceConfig = {
+          ExecStart = "${prl-tools}/bin/prlcp";
+        };
+      };
+      prlsga = {
+        description = "Parallels Shared Guest Applications Tool";
+        wantedBy = [ "graphical-session.target" ];
+        serviceConfig = {
+          ExecStart = "${prl-tools}/bin/prlsga";
+        };
+      };
+      prlshprof = {
+        description = "Parallels Shared Profile Tool";
+        wantedBy = [ "graphical-session.target" ];
+        serviceConfig = {
+          ExecStart = "${prl-tools}/bin/prlshprof";
+        };
+      };
+    };
+
   };
 }
diff --git a/pkgs/os-specific/linux/prl-tools/default.nix b/pkgs/os-specific/linux/prl-tools/default.nix
index 9ca48ccaf057f..9fe331e6cb12f 100644
--- a/pkgs/os-specific/linux/prl-tools/default.nix
+++ b/pkgs/os-specific/linux/prl-tools/default.nix
@@ -1,6 +1,7 @@
 { stdenv, lib, requireFile, makeWrapper, substituteAll, p7zip
 , gawk, utillinux, xorg, glib, dbus_glib, zlib
 , kernel ? null, libsOnly ? false
+, undmg, fetchurl
 }:
 
 assert (!libsOnly) -> kernel != null;
@@ -10,57 +11,35 @@ let xorgFullVer = (builtins.parseDrvName xorg.xorgserver.name).version;
     x64 = if stdenv.system == "x86_64-linux" then true
           else if stdenv.system == "i686-linux" then false
           else abort "Parallels Tools for Linux only support {x86-64,i686}-linux targets";
-    # We autostart user services by ourselves, because prlcc uses hardcoded paths.
-    autostart = [ { exec = "prlcc";
-                    description = "Parallels Control Center";
-                  }
-                  { exec = "prldhd";
-                    description = "Parallels Control Center"; # not a mistake
-                  }
-                  { exec = "prl_wmouse_d";
-                    description = "Parallels Walking Mouse Daemon";
-                  }
-                  { exec = "prlcp";
-                    description = "Parallels CopyPaste Tool";
-                  }
-                  { exec = "prlsga";
-                    description = "Parallels Shared Guest Applications Tool";
-                  }
-                  { exec = "prlshprof";
-                    description = "Parallels Shared Profile Tool";
-                  }
-                ];
 in
 stdenv.mkDerivation rec {
-  version = "10.0.2.27712";
+  version = "${prl_major}.2.1-41615";
+  prl_major = "12";
   name = "prl-tools-${version}";
 
-  src = requireFile rec {
-    name = "prl-tools-lin.iso";
-    sha256 = "07960jvyv7gihjlg922znjm6db6l6bd23x9mg6ympwibzf2mylmx";
-    message = ''
-      Please, place Parallels Tools for Linux image into Nix store
-      using either
-        nix-store --add-fixed sha256 ${name}
-      or
-        nix-prefetch-url file://path/to/${name}
-    '';
+  # We download the full distribution to extract prl-tools-lin.iso from
+  # => ${dmg}/Parallels\ Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso
+  src = fetchurl {
+    url =  "https://download.parallels.com/desktop/v${prl_major}/${version}/ParallelsDesktop-${version}.dmg";
+    sha256 = "1jwzwif69qlhmfky9kigjaxpxfj0lyrl1iyrpqy4iwqvajdgbbym";
   };
 
-  hardeningDisable = [ "pic" ];
+  hardeningDisable = [ "pic" "format" ];
 
   # also maybe python2 to generate xorg.conf
-  nativeBuildInputs = [ p7zip ] ++ lib.optionals (!libsOnly) [ makeWrapper ];
+  nativeBuildInputs = [ p7zip undmg ] ++ lib.optionals (!libsOnly) [ makeWrapper ];
 
   inherit libsOnly;
 
   unpackPhase = ''
-    7z x $src
-    export sourceRoot=.
+    undmg < "${src}"
+
+    export sourceRoot=prl-tools-build
+    7z x "Parallels Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso" -o$sourceRoot
     if test -z "$libsOnly"; then
-      ( cd kmods; tar -xaf prl_mod.tar.gz )
+      ( cd $sourceRoot/kmods; tar -xaf prl_mod.tar.gz )
     fi
-    ( cd tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
+    ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
   '';
 
   kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version;
@@ -88,11 +67,6 @@ stdenv.mkDerivation rec {
             stdenv.lib.makeLibraryPath ([ stdenv.cc.cc libXrandr libXext libX11 libXcomposite libXinerama ]
             ++ lib.optionals (!libsOnly) [ libXi glib dbus_glib zlib ]);
 
-  desktops = map (x: substituteAll ({
-               src = ./autostart.desktop;
-               name = x.exec + ".desktop";
-               version = version;
-             } // x)) autostart;
 
   installPhase = ''
     if test -z "$libsOnly"; then
@@ -124,7 +98,7 @@ stdenv.mkDerivation rec {
           patchelf \
             --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             --set-rpath "$out/lib:$libPath" \
-            $i
+            $i || true
         done
 
         mkdir -p $out/bin
@@ -145,11 +119,6 @@ stdenv.mkDerivation rec {
           sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i
         done
 
-        mkdir -p $out/share/autostart
-        for i in $desktops; do
-          cat $i | sed "s,^Exec=,Exec=$out/bin/," > $out/share/autostart/$(basename $i)
-        done
-
         (
           cd xorg.${xorgVer}
           # Install the X modules.
@@ -189,8 +158,8 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "Parallels Tools for Linux guests";
-    homepage = http://parallels.com;
-    platforms = platforms.linux;
+    homepage = https://parallels.com;
+    platforms = [ "i686-linux" "x86_64-linux" ];
     license = licenses.unfree;
     # I was making this package blindly and requesting testing from the real user,
     # so I can't even test it by myself and won't provide future updates.