diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-05-31 09:59:33 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-05-31 09:59:57 +0000 |
commit | 9ff36293d1e428cd7bf03e8d4b03611b6d361c28 (patch) | |
tree | 1ab51a42b868c55b83f6ccdb80371b9888739dd9 /pkgs/os-specific/linux/prl-tools | |
parent | 1c4fcd0d4b0541e674ee56ace1053e23e562cc80 (diff) | |
parent | ddc3c396a51918043bb0faa6f676abd9562be62c (diff) | |
download | nixpkgs-archive.tar nixpkgs-archive.tar.gz nixpkgs-archive.tar.bz2 nixpkgs-archive.tar.lz nixpkgs-archive.tar.xz nixpkgs-archive.tar.zst nixpkgs-archive.zip |
Last good Nixpkgs for Weston+nouveau? archive
I came this commit hash to terwiz[m] on IRC, who is trying to figure out what the last version of Spectrum that worked on their NUC with Nvidia graphics is.
Diffstat (limited to 'pkgs/os-specific/linux/prl-tools')
-rw-r--r-- | pkgs/os-specific/linux/prl-tools/autostart.desktop | 8 | ||||
-rw-r--r-- | pkgs/os-specific/linux/prl-tools/default.nix | 168 |
2 files changed, 176 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/prl-tools/autostart.desktop b/pkgs/os-specific/linux/prl-tools/autostart.desktop new file mode 100644 index 00000000000..b8eb27fdd99 --- /dev/null +++ b/pkgs/os-specific/linux/prl-tools/autostart.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Version=@version@ +Encoding=UTF-8 +Name=@description@ +Type=Application +Exec=@exec@ +X-KDE-autostart-phase=1 +GenericName[en_US]= diff --git a/pkgs/os-specific/linux/prl-tools/default.nix b/pkgs/os-specific/linux/prl-tools/default.nix new file mode 100644 index 00000000000..e6c246de0d2 --- /dev/null +++ b/pkgs/os-specific/linux/prl-tools/default.nix @@ -0,0 +1,168 @@ +{ stdenv, lib, makeWrapper, p7zip +, gawk, util-linux, xorg, glib, dbus-glib, zlib +, kernel ? null, libsOnly ? false +, undmg, fetchurl +}: + +assert (!libsOnly) -> kernel != null; + +let xorgFullVer = lib.getVersion xorg.xorgserver; + xorgVer = lib.versions.majorMinor xorgFullVer; + x64 = if stdenv.hostPlatform.system == "x86_64-linux" then true + else if stdenv.hostPlatform.system == "i686-linux" then false + else throw "Parallels Tools for Linux only support {x86-64,i686}-linux targets"; +in +stdenv.mkDerivation rec { + version = "${prl_major}.2.1-41615"; + prl_major = "12"; + pname = "prl-tools"; + + # 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" "format" ]; + + # also maybe python2 to generate xorg.conf + nativeBuildInputs = [ p7zip undmg ] ++ lib.optionals (!libsOnly) [ makeWrapper ] ++ kernel.moduleBuildDependencies; + + inherit libsOnly; + + unpackPhase = '' + 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 $sourceRoot/kmods; tar -xaf prl_mod.tar.gz ) + fi + ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz ) + ''; + + kernelVersion = if libsOnly then "" else lib.getName kernel.name; + kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}"; + scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${util-linux}/bin" "${gawk}/bin" ]); + + buildPhase = '' + if test -z "$libsOnly"; then + ( # kernel modules + cd kmods + make -f Makefile.kmods \ + KSRC=$kernelDir/source \ + HEADERS_CHECK_DIR=$kernelDir/source \ + KERNEL_DIR=$kernelDir/build \ + SRC=$kernelDir/build \ + KVER=$kernelVersion + ) + + # Xorg config (maybe would be useful for other versions) + #python2 installer/xserver-config.py xorg ${xorgVer} /dev/null parallels.conf + fi + ''; + + libPath = with xorg; + lib.makeLibraryPath ([ stdenv.cc.cc libXrandr libXext libX11 libXcomposite libXinerama ] + ++ lib.optionals (!libsOnly) [ libXi glib dbus-glib zlib ]); + + + installPhase = '' + if test -z "$libsOnly"; then + ( # kernel modules + cd kmods + mkdir -p $out/lib/modules/${kernelVersion}/extra + cp prl_eth/pvmnet/prl_eth.ko $out/lib/modules/${kernelVersion}/extra + cp prl_tg/Toolgate/Guest/Linux/prl_tg/prl_tg.ko $out/lib/modules/${kernelVersion}/extra + cp prl_fs/SharedFolders/Guest/Linux/prl_fs/prl_fs.ko $out/lib/modules/${kernelVersion}/extra + cp prl_fs_freeze/Snapshot/Guest/Linux/prl_freeze/prl_fs_freeze.ko $out/lib/modules/${kernelVersion}/extra + ) + fi + + ( # tools + cd tools + mkdir -p $out/lib + + if test -z "$libsOnly"; then + # install binaries + for i in bin/* sbin/prl_nettool sbin/prl_snapshot; do + install -Dm755 $i $out/$i + done + # other binaries + for i in xorg.7.1/usr/bin/*; do + cp $i $out/bin + done + + for i in $out/bin/* $out/sbin/*; do + patchelf \ + --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "$out/lib:$libPath" \ + $i || true + done + + mkdir -p $out/bin + install -Dm755 ../installer/prlfsmountd.sh $out/sbin/prlfsmountd + wrapProgram $out/sbin/prlfsmountd \ + --prefix PATH ':' "$scriptPath" + + for i in lib/*.a; do + cp $i $out/lib + done + + for i in xorg.7.1/usr/lib/libprl_wmouse_watcher.*; do + cp $i $out/lib + done + + mkdir -p $out/lib/udev/rules.d + for i in *.rules; do + sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i + done + + ( + cd xorg.${xorgVer} + # Install the X modules. + ( + cd x-server/modules + for i in */*; do + install -Dm755 $i $out/lib/xorg/modules/$i + done + ) + ( + cd usr/lib + libGLXname=$(echo libglx.so*) + install -Dm755 $libGLXname $out/lib/xorg/modules/extensions/$libGLXname + ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so + ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so.1 + ) + ) + fi + + for i in xorg.7.1/usr/lib/libGL.*; do + cp $i $out/lib + done + + cd $out + find -name \*.so\* -type f -exec \ + patchelf --set-rpath "$out/lib:$libPath" {} \; + + cd lib + libGLname=$(echo libGL.so*) + ln -s $libGLname libGL.so + ln -s $libGLname libGL.so.1 + ) + ''; + + dontStrip = true; + dontPatchELF = true; + + meta = with lib; { + description = "Parallels Tools for Linux guests"; + 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. + maintainers = with maintainers; [ abbradar ]; + }; +} |