Merge pull request #27513 from lukeadams/prl-tools-fix
[NixOS] Fix + update `hardware.parallels` config option
This commit is contained in:
commit
487c4a6f6e
@ -27,7 +27,6 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf config.hardware.parallels.enable {
|
config = mkIf config.hardware.parallels.enable {
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
drivers = singleton
|
drivers = singleton
|
||||||
{ name = "prlvideo"; modules = [ prl-tools ]; libPath = [ prl-tools ]; };
|
{ name = "prlvideo"; modules = [ prl-tools ]; libPath = [ prl-tools ]; };
|
||||||
@ -55,7 +54,7 @@ in
|
|||||||
|
|
||||||
boot.extraModulePackages = [ prl-tools ];
|
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;
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{ stdenv, lib, requireFile, makeWrapper, substituteAll, p7zip
|
{ stdenv, lib, requireFile, makeWrapper, substituteAll, p7zip
|
||||||
, gawk, utillinux, xorg, glib, dbus_glib, zlib
|
, gawk, utillinux, xorg, glib, dbus_glib, zlib
|
||||||
, kernel ? null, libsOnly ? false
|
, kernel ? null, libsOnly ? false
|
||||||
|
, undmg, fetchurl
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert (!libsOnly) -> kernel != null;
|
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
|
x64 = if stdenv.system == "x86_64-linux" then true
|
||||||
else if stdenv.system == "i686-linux" then false
|
else if stdenv.system == "i686-linux" then false
|
||||||
else abort "Parallels Tools for Linux only support {x86-64,i686}-linux targets";
|
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
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "10.0.2.27712";
|
version = "${prl_major}.2.1-41615";
|
||||||
|
prl_major = "12";
|
||||||
name = "prl-tools-${version}";
|
name = "prl-tools-${version}";
|
||||||
|
|
||||||
src = requireFile rec {
|
# We download the full distribution to extract prl-tools-lin.iso from
|
||||||
name = "prl-tools-lin.iso";
|
# => ${dmg}/Parallels\ Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso
|
||||||
sha256 = "07960jvyv7gihjlg922znjm6db6l6bd23x9mg6ympwibzf2mylmx";
|
src = fetchurl {
|
||||||
message = ''
|
url = "https://download.parallels.com/desktop/v${prl_major}/${version}/ParallelsDesktop-${version}.dmg";
|
||||||
Please, place Parallels Tools for Linux image into Nix store
|
sha256 = "1jwzwif69qlhmfky9kigjaxpxfj0lyrl1iyrpqy4iwqvajdgbbym";
|
||||||
using either
|
|
||||||
nix-store --add-fixed sha256 ${name}
|
|
||||||
or
|
|
||||||
nix-prefetch-url file://path/to/${name}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hardeningDisable = [ "pic" ];
|
hardeningDisable = [ "pic" "format" ];
|
||||||
|
|
||||||
# also maybe python2 to generate xorg.conf
|
# also maybe python2 to generate xorg.conf
|
||||||
nativeBuildInputs = [ p7zip ] ++ lib.optionals (!libsOnly) [ makeWrapper ];
|
nativeBuildInputs = [ p7zip undmg ] ++ lib.optionals (!libsOnly) [ makeWrapper ];
|
||||||
|
|
||||||
inherit libsOnly;
|
inherit libsOnly;
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
7z x $src
|
undmg < "${src}"
|
||||||
export sourceRoot=.
|
|
||||||
|
export sourceRoot=prl-tools-build
|
||||||
|
7z x "Parallels Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso" -o$sourceRoot
|
||||||
if test -z "$libsOnly"; then
|
if test -z "$libsOnly"; then
|
||||||
( cd kmods; tar -xaf prl_mod.tar.gz )
|
( cd $sourceRoot/kmods; tar -xaf prl_mod.tar.gz )
|
||||||
fi
|
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;
|
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 ]
|
stdenv.lib.makeLibraryPath ([ stdenv.cc.cc libXrandr libXext libX11 libXcomposite libXinerama ]
|
||||||
++ lib.optionals (!libsOnly) [ libXi glib dbus_glib zlib ]);
|
++ lib.optionals (!libsOnly) [ libXi glib dbus_glib zlib ]);
|
||||||
|
|
||||||
desktops = map (x: substituteAll ({
|
|
||||||
src = ./autostart.desktop;
|
|
||||||
name = x.exec + ".desktop";
|
|
||||||
version = version;
|
|
||||||
} // x)) autostart;
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
if test -z "$libsOnly"; then
|
if test -z "$libsOnly"; then
|
||||||
@ -124,7 +98,7 @@ stdenv.mkDerivation rec {
|
|||||||
patchelf \
|
patchelf \
|
||||||
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||||
--set-rpath "$out/lib:$libPath" \
|
--set-rpath "$out/lib:$libPath" \
|
||||||
$i
|
$i || true
|
||||||
done
|
done
|
||||||
|
|
||||||
mkdir -p $out/bin
|
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
|
sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i
|
||||||
done
|
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}
|
cd xorg.${xorgVer}
|
||||||
# Install the X modules.
|
# Install the X modules.
|
||||||
@ -189,8 +158,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Parallels Tools for Linux guests";
|
description = "Parallels Tools for Linux guests";
|
||||||
homepage = http://parallels.com;
|
homepage = https://parallels.com;
|
||||||
platforms = platforms.linux;
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
||||||
license = licenses.unfree;
|
license = licenses.unfree;
|
||||||
# I was making this package blindly and requesting testing from the real user,
|
# 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.
|
# so I can't even test it by myself and won't provide future updates.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user