Merge pull request #27513 from lukeadams/prl-tools-fix

[NixOS] Fix + update `hardware.parallels` config option

authored by Jörg Thalheim and committed by GitHub 487c4a6f a30fa6d9

+65 -52
+46 -2
nixos/modules/virtualisation/parallels-guest.nix
··· 27 27 }; 28 28 29 29 config = mkIf config.hardware.parallels.enable { 30 - 31 30 services.xserver = { 32 31 drivers = singleton 33 32 { name = "prlvideo"; modules = [ prl-tools ]; libPath = [ prl-tools ]; }; ··· 55 54 56 55 boot.extraModulePackages = [ prl-tools ]; 57 56 58 - boot.kernelModules = [ "prl_tg" "prl_eth" "prl_fs" "prl_fs_freeze" "acpi_memhotplug" ]; 57 + boot.kernelModules = [ "prl_tg" "prl_eth" "prl_fs" "prl_fs_freeze" ]; 59 58 60 59 services.timesyncd.enable = false; 61 60 ··· 86 85 serviceConfig = { 87 86 Type = "forking"; 88 87 ExecStart = "${prl-tools}/bin/prlshprint"; 88 + }; 89 + }; 90 + 91 + systemd.user.services = { 92 + prlcc = { 93 + description = "Parallels Control Center"; 94 + wantedBy = [ "graphical-session.target" ]; 95 + serviceConfig = { 96 + ExecStart = "${prl-tools}/bin/prlcc"; 97 + }; 98 + }; 99 + prldnd = { 100 + description = "Parallels Control Center"; 101 + wantedBy = [ "graphical-session.target" ]; 102 + serviceConfig = { 103 + ExecStart = "${prl-tools}/bin/prldnd"; 104 + }; 105 + }; 106 + prl_wmouse_d = { 107 + description = "Parallels Walking Mouse Daemon"; 108 + wantedBy = [ "graphical-session.target" ]; 109 + serviceConfig = { 110 + ExecStart = "${prl-tools}/bin/prl_wmouse_d"; 111 + }; 112 + }; 113 + prlcp = { 114 + description = "Parallels CopyPaste Tool"; 115 + wantedBy = [ "graphical-session.target" ]; 116 + serviceConfig = { 117 + ExecStart = "${prl-tools}/bin/prlcp"; 118 + }; 119 + }; 120 + prlsga = { 121 + description = "Parallels Shared Guest Applications Tool"; 122 + wantedBy = [ "graphical-session.target" ]; 123 + serviceConfig = { 124 + ExecStart = "${prl-tools}/bin/prlsga"; 125 + }; 126 + }; 127 + prlshprof = { 128 + description = "Parallels Shared Profile Tool"; 129 + wantedBy = [ "graphical-session.target" ]; 130 + serviceConfig = { 131 + ExecStart = "${prl-tools}/bin/prlshprof"; 132 + }; 89 133 }; 90 134 }; 91 135
+19 -50
pkgs/os-specific/linux/prl-tools/default.nix
··· 1 1 { stdenv, lib, requireFile, makeWrapper, substituteAll, p7zip 2 2 , gawk, utillinux, xorg, glib, dbus_glib, zlib 3 3 , kernel ? null, libsOnly ? false 4 + , undmg, fetchurl 4 5 }: 5 6 6 7 assert (!libsOnly) -> kernel != null; ··· 10 11 x64 = if stdenv.system == "x86_64-linux" then true 11 12 else if stdenv.system == "i686-linux" then false 12 13 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 14 in 34 15 stdenv.mkDerivation rec { 35 - version = "10.0.2.27712"; 16 + version = "${prl_major}.2.1-41615"; 17 + prl_major = "12"; 36 18 name = "prl-tools-${version}"; 37 19 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"; 48 25 }; 49 26 50 - hardeningDisable = [ "pic" ]; 27 + hardeningDisable = [ "pic" "format" ]; 51 28 52 29 # also maybe python2 to generate xorg.conf 53 - nativeBuildInputs = [ p7zip ] ++ lib.optionals (!libsOnly) [ makeWrapper ]; 30 + nativeBuildInputs = [ p7zip undmg ] ++ lib.optionals (!libsOnly) [ makeWrapper ]; 54 31 55 32 inherit libsOnly; 56 33 57 34 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 60 39 if test -z "$libsOnly"; then 61 - ( cd kmods; tar -xaf prl_mod.tar.gz ) 40 + ( cd $sourceRoot/kmods; tar -xaf prl_mod.tar.gz ) 62 41 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 ) 64 43 ''; 65 44 66 45 kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version; ··· 88 67 stdenv.lib.makeLibraryPath ([ stdenv.cc.cc libXrandr libXext libX11 libXcomposite libXinerama ] 89 68 ++ lib.optionals (!libsOnly) [ libXi glib dbus_glib zlib ]); 90 69 91 - desktops = map (x: substituteAll ({ 92 - src = ./autostart.desktop; 93 - name = x.exec + ".desktop"; 94 - version = version; 95 - } // x)) autostart; 96 70 97 71 installPhase = '' 98 72 if test -z "$libsOnly"; then ··· 124 98 patchelf \ 125 99 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 126 100 --set-rpath "$out/lib:$libPath" \ 127 - $i 101 + $i || true 128 102 done 129 103 130 104 mkdir -p $out/bin ··· 145 119 sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i 146 120 done 147 121 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 - 153 122 ( 154 123 cd xorg.${xorgVer} 155 124 # Install the X modules. ··· 189 158 190 159 meta = with stdenv.lib; { 191 160 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" ]; 194 163 license = licenses.unfree; 195 164 # I was making this package blindly and requesting testing from the real user, 196 165 # so I can't even test it by myself and won't provide future updates.